cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Validation Web Form Power Portal

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!

byansakura_0-1599632297898.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
hardikv
Memorable Member
Memorable Member

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!

View solution in original post

2 REPLIES 2
justinburch
Microsoft
Microsoft

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?

hardikv
Memorable Member
Memorable Member

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!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Users online (1,689)