Buy Now
Sign in

Pass URL variable/parameter to modal form

Gatsman , March 03 at 19:40
Gatsman
Hello, i am trying the Chronoforms 6 Modal form. I am working on the demo modal form.​
​The way that I try to make it work is to create 3-4 "buttons" outside of the form with the class .open_modal_form that will all trigger the modal form when clicked, all good up to this, now is there a way for the form to know which element (what ID) triggered (I think one way could be with JavaScript) the form and also any way to pass others parameters to that form too?​
Gatsman

​I managed to do this with jQuery so if anyone else cares about it.
- Add a name="MY_VARIABLE" to the button that triggers the form
- Add a field with the id="my_variable" (you might want it to be hidden...)
- Add a Custom Code before the Display Section in the Setup with this code
<script>​
​jQuery("#open_form_button").click(function(){​
​var my_variable = jQuery(this).attr('name');​
​jQuery('#my_variable').val(my_variable);​
​});​
​</script>