Master Posted March 3, 2014 Report Share Posted March 3, 2014 How can I show an error message if the amount entered in a submission page is less than a certain value? Quote Link to comment Share on other sites More sharing options...
pavitra2410 Posted March 3, 2014 Report Share Posted March 3, 2014 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> Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 5, 2014 Report Share Posted March 5, 2014 Thank you CaspioEnthusiast! Basically we can use "return false;" to prevent form from being submitted Quote Link to comment Share on other sites More sharing options...
sjoerd Posted August 11, 2016 Report Share Posted August 11, 2016 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? Quote Link to comment Share on other sites More sharing options...
sjoerd Posted August 11, 2016 Report Share Posted August 11, 2016 I figured it out already. By using parseFloat(document.getElementById("cbParamVirtual2").value) i was able to compare it to my authentication field, which i put into Virtual2. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.