Javascript at form submission
Permalink
Hi,
I am currently using the default concrete5 form to get contact information.
I would like to add some Javascript to run when the form is submitted (namely to set some cookie at least).
Do I need to modify the controller? Is there an easy way to plug that in ? If the same controller is used in different places on the same installation, is there a way to tell where an instance is used ?
Thanks,
Matthieu
I am currently using the default concrete5 form to get contact information.
I would like to add some Javascript to run when the form is submitted (namely to set some cookie at least).
Do I need to modify the controller? Is there an easy way to plug that in ? If the same controller is used in different places on the same installation, is there a way to tell where an instance is used ?
Thanks,
Matthieu
http://www.concrete5.org/marketplace/addons/ajax-form...
You might just be able to piggyback on that to do what you want. Otherwise, use it as an example of how to do javascripty stuff with the form block. Note that this actually has the form being submitted via ajax -- but maybe you don't want to submit the form via ajax but instead just want to run some code when the submission happens? If that's the case, it's probably just a matter of customizing the form block template and adding some JS -- for example, seehttp://stackoverflow.com/questions/8263988/how-can-i-run-code-right...