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
MPP IDEAS updated 768x460.png

Ideas

Discover ideas and concepts from users like you for how to use Power Pages and take your work to the next level.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Top Solution Authors
Users online (3,409)