I'm currently developing a Joomla module that will be a simple contact us form.
When the form errors out for some reason, I want to retain the data the user input into the various fields so they don't lose what they typed in.
I've been able to make it work for most fields, but email is stumping me.
The reason is Joomla seems to apply email cloaking using Javascript, and when I retrieve the post parameter instead of a plain email address like the user typed, Joomla returns the javascript and sticks that in the field instead.
How do I get the raw email address without the added cloaking?
Here is the code I'm using to retain the entered data in the event the form isn't submitted properly.
<p>
<label ><?php echo $email ?></label>
<input type="email" name="email" id="email"
value="<?php echo isset($_POST['email'])
? JFactory::getApplication()->input->get('email','','STRING')
: "Enter Email Address" ?>"/>
</p>
I finally figured this out. With Joomla to disable email cloaking on a certain page, just insert the following code anywhere in the same article where you want it to be disabled:
{emailcloak=off}
The cloaking happens via a content plugin called "Content - Email Cloaking" which you can simply turn off in your plugin manager. Another option would be to not parse plugins in your module...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With