Forums

Embedded Form don't work - call form in PHP

TeeWee 24 Mar, 2018
Hello,
in Joomla (3.8.6) I would like to install a Chronoform V6 form in a self-written component (address directory).

Logic: ... bla..bla .. IF ($address-> email) { show mailform } ... bla ..bla ..

I have tried 2 ways to show the form:
  1. As PopUp:
    JHTML:: _('behavior.modal');
    <a class="modal" id="load_chrono" href="/index.php?option=com_chronofrom6&chronoform=mailform&tmpl=component" rel="{handler:'iframe', size:{x:500, y: 649} }"> Send mail </a>
    That way, it works well.
  2. Embedded:
    $ module = JModuleHelper :: getModule ('mod_chronoforms6', 'mailform');
    if ($ module-> id) {echo JModuleHelper :: renderModule ($ module);}
    That way, the form will be displayed but will not work.
    No validation, no calendar, .... no functionality.
    Not even if I adjust the action URL in Form-> Setup.
Unfortunately only the 2nd way fulfills my purposes.
Thankful for help or any idea
Regards
Thomas
GreyHead 24 Mar, 2018
Hi Thomas,

At a guess the second method is not loading any of the ChronoForms support files into your modal window.

Bob
TeeWee 24 Mar, 2018
First of all let me thank you for the quick response :-)

May be it could be a misunderstanding?
1. is modal (modal iframe) and it works well.
2. is embedded: should renderModule($ module) under the condition that email is stored in database.
Unfortunately 2. is suitable. Form is rendered in place but did not work proper.

Is it reasonable/possible to load/include Chronoforms support files manually .
And if so, which are necessary.

Regards
Thomas
GreyHead 25 Mar, 2018
Hi Thomas,

Have you checked to see if the CF support files are being loaded?

Bob
TeeWee 25 Mar, 2018
Hi Bob,
there is an essential difference in the html source of the two different variants.
In the embedded version the following script-code is missing:
<script>
setInterval(function (){jQuery.get("https://www.dialyse-online.de/index.php?option=com_chronoforms6&chronoform=mailform&tmpl=component "); 300000);
jQuery(document) .ready(function ($){$.G2.forms.invisible();
$ ('body'). on ('contentChange.form', 'form', function (e) {e.stopPropagation();
$.G2.forms.ready($(this));});
.$('Form')trigger ('contentchange');});
</ Script>
<script type = "text / javascript">
jQuery(document) .ready(function ($){$("div.G2-joomla")trigger ("contentchange.");});
</ Script>

In which file is the script inserted / where does it come from?

regards
Thomas
GreyHead 25 Mar, 2018
Hi Thomas,

Sorry, I have no idea where that script comes from. I did a search but did not locate it.

Bob
TeeWee 25 Mar, 2018
Hi Bob,

So did i befor (with clean unzipped chronoform6 component) ...
Well then I will continue searching


anyway, thanks a lot
Thomas
And by the way: Chronoform is a great componente. Very usefull and comfortable.
Max_admin 26 Mar, 2018
Answer
Hi Thomas,

You can print the Chronoforms6 plugin syntax and then parse it to execute the plugin code: {chronoforms6}mailform{/chronoforms6}

Or you can use this line in your PHP code:
file_get_contents("http://www.domain.com/index.php?option=com_chronofrom6&chronoform=mailform&tmpl=component");

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
TeeWee 26 Mar, 2018
Thanks a lot Max!
file_get_contents
... works perfect!

regards
Thomas
TeeWee 28 Mar, 2018
Sorry, it's me again
"... works perfect!" was a little early :-(
I inserted the form via file_get_contents and the funtionality is well given on desktop PC but not on mobile devices (tablet, smartphone)
No hints for required fields and no calendar, ...
AND i did it the same way on an other page (same website) and it works on all devices?!?

Any ideas or suggestions

regards
Thomas
Max_admin 30 Mar, 2018
Hi Thomas,

You may try the plugin workaround then and use PHP code to process the plugin syntax.
$mainframe = \JFactory::getApplication();
$contentParams = \JComponentHelper::getParams('com_content');
$dispatcher = \JDispatcher::getInstance();
$type = 'content';
\JPluginHelper::importPlugin($type);
$context = '';
$rowPlg = new \stdClass();
$rowPlg->text = '{chronoforms6}form-alias{/chronoforms6}';
$results = $mainframe->triggerEvent('onContentPrepare', array($context, &$rowPlg, &$contentParams, 0));
echo $rowPlg->text;

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.