Jump to content
Sign in to follow this  
Master

Show Conditional Error On A Submission Page If Entered Data Is Less Than A ...

Recommended Posts

Just add the following JavaScript in a footer of the submission form to validate for that field. Replace XXX with your value.

 

<script>
var num=XXX;
function chk_num(){
var mynum = document.getElementById('InsertRecordFIELDNAME').value;
if ( mynum < num ) {
alert('Enter your message here');
return false;
}
}
document.getElementById('caspioform').onsubmit=chk_num;
</script>

Share this post


Link to post
Share on other sites

I tried using this method today (mynum > num (instead of mynum < num)) but I came across the following problem. 

Instead of defining var num as a predifined number, I want to use an authentication field. Depending on this field var num will be 100/1000/1500. When I test this and enter a number higher than the limitation it gives me the error message, but when I fill in a lower number (after the error message) it will give me the same message. When I submit a correct value in the first place it works perfectly. How do i fix this?

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...