Getting JS var from rendered page to JS validate script
Posted: 2019-07-10 17:35
Hi AppGini'ers
I have a form, say "myform", which contains a hidden field quantityMax
I have a validation script, say myform-dv.js (based on the UDEMY lessons)
I see that there is an array in the rendered form containing the value I want, within script tags - var data = {quantityMin: "200", quantityMax: "500"};
How can I pass the data() value to the validation function in myform-dv.js file?
Alternatively,
I have a hook file, say myform.php (which has a value for the $quantityMax field, taken from the DB)
How can I pass the $quantityMaxvar value in php to the JS script?
TIA, James
I have a form, say "myform", which contains a hidden field quantityMax
I have a validation script, say myform-dv.js (based on the UDEMY lessons)
I see that there is an array in the rendered form containing the value I want, within script tags - var data = {quantityMin: "200", quantityMax: "500"};
How can I pass the data() value to the validation function in myform-dv.js file?
Alternatively,
I have a hook file, say myform.php (which has a value for the $quantityMax field, taken from the DB)
How can I pass the $quantityMaxvar value in php to the JS script?
TIA, James