Buy Now
Sign in

PHP getting commented out

liamhanks , February 10 2017, 20:04
L
liamhanks 14
February 10 2017, 20:04 #364988
Hi,
When setting up my form 'on submit' actions, any actions that allow the text editor option (for example, Display Message or Email (message content), I'm unable to include any php, as the opening tags (and any following 'greater-than' tags) are getting converted to HTML comments, even if the editor is disabled.

For example:
<?php if($form->data['name'] === ""){do something;}


becomes:
<!-- php if($form- --/>data['name'] === ""){do something;}


...which aside from creating some funky output, is completing trashing my ability to dynamically display fields in thank-you messages and emails. Obviously something is rewriting the output, but I'm at a loss to determine what. I've even disabled TinyMCE altogether in Joomla, but still no luck.

I'm using the latest CF on joomla 3.6.5. I haven't added the Joomla Plugins action to the form. I can provide more details about installed extensions, etc. if needed.

I'd greatly appreciate any thoughts or suggestions.

Thanks
GreyHead 65
February 10 2017, 22:51 #364990
Hi usainteanne,

You can't use PHP where there is a WYSIWYG editor.

For the Thank you message use a Custom Code action - no editor but does accept PHP and the output is the same.

For the Email either turn off the editor or create the custom HTML in a Custom Code action before the email and save the result to the $form->data array as e.g. $form->data['some_html'] you can then put {some_html} in the Email template.

Bob
If you'd like to buy me a coffee or two, thank you very much
L
liamhanks 14
February 14 2017, 14:22 #365093
Hi Bob,
putting all the PHP is custom code actions and using curly brackets in the WYSISWYG boxes appears to work perfectly.

Thanks for the quick response!