Announcements
Hey, I tried to set up a validation upon submitting my web form, it succeeded when i made the condition with value, however when i used variable, it fails. Anyone has any idea why? Thank you in advance!
Hi @Anonymous,
When you say it succeeded with values, do you mean you hard-coded them?
Is this wrapped in a "document.ready" to make sure the form has loaded everything?If you take the function from the validatorfunction and run it in your dev console (F12 of browser), what is the result? If you check the .val() of each jquery query, what are the values?
Hi @Anonymous
Variable names might be create an issue because you have added variable name same as field name.
Please try below code or change the variable name:
var cr898_filltokenData = $("#cr898_filltoken").val(); var cr898_tokenData = $("#cr898_token").val(); if(cr898_filltokenData != cr898_tokenData ) { return false; } else { return true; }
--------------------------If you like this post, give a Thumbs up. Where it solved your query, Mark as a Solution so it can help other people!
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Jump in, show your community spirit, and win prizes!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 36
Valantis 30
omkarsupreme 23