E-Mail field in form block?
Permalink
Hi all.
I was wondering if it's possible to add an e-mail field to a form block?
An e-mail field would be the same as a regular text-field but with validation for a proper e-mail address.
Apparently it's not possible with the vanilla form-block, therefore I was wondering how this can be done?
What classes do I have to override to get the desired functionality? I'm a PHP Programmer, but a Concrete5 noob, so please bear with me :)
I was wondering if it's possible to add an e-mail field to a form block?
An e-mail field would be the same as a regular text-field but with validation for a proper e-mail address.
Apparently it's not possible with the vanilla form-block, therefore I was wondering how this can be done?
What classes do I have to override to get the desired functionality? I'm a PHP Programmer, but a Concrete5 noob, so please bear with me :)
Hi kino
Thanks for the reply. I tried your add-on but it doesn't work. If I create a AjaxForm and submit, the values are sent as usual (normal HTTP POST request). And apparently there is no server-side validation which makes it easy to submit invalid values by simply deactivating JavaScript?
Thanks for the reply. I tried your add-on but it doesn't work. If I create a AjaxForm and submit, the values are sent as usual (normal HTTP POST request). And apparently there is no server-side validation which makes it easy to submit invalid values by simply deactivating JavaScript?
I solved the problem by adding the desired functionality to form/controller.php and form/form_setup_html.php
Not very elegant and messing with core files.. but I just don't have the time for a more sophisticated solution right now.
I attached the patch files to this post to anybody that's interested. The patch basically allows you to choose type "Email" from the list of available field types. Then the value is validated server-side to match an email-pattern.
Not very elegant and messing with core files.. but I just don't have the time for a more sophisticated solution right now.
I attached the patch files to this post to anybody that's interested. The patch basically allows you to choose type "Email" from the list of available field types. Then the value is validated server-side to match an email-pattern.
Hi Banal, did you ever develop this further to allow the email that is sent to use the email in that field to be put in the 'from/reply-to' field?, issue at the mo is emails are coming from the admin email and not the person who submitted the form.
Cheers
Cheers
Hi
No, I didn't extend my solution. It was a bad approach from the start, since I had to change core-files. But at the time being there was just no alternative (except maybe building a new "form-module" but that wasn't an option).
Shouldn't be hard to hack more stuff into it.. but its never going to be a good solution IMHO unless the functionality gets implemented into the core by the concrete5 devs.
No, I didn't extend my solution. It was a bad approach from the start, since I had to change core-files. But at the time being there was just no alternative (except maybe building a new "form-module" but that wasn't an option).
Shouldn't be hard to hack more stuff into it.. but its never going to be a good solution IMHO unless the functionality gets implemented into the core by the concrete5 devs.
If you wanted to do javascript validation, use could just use the jquery submit event and code it into either view.php or auto.js.
As a side note, however, I'd love to see some of this functionality built into the form block itself. Of course, there's a million different things you could do, but maybe some validation functionality would be of greatest benefit to the most people. i also think some sort of auto-populate feature would be nice (automatically fill in states, countries, months...a few things like that that are commonly displayed in forms).