lmooring Posted January 5, 2017 Report Share Posted January 5, 2017 Hi Caspio World, I feel like this is an easy one, but I am not able to figure out the java scripting. I have two fields on a submission form; Cost and Retail. I am looking for a simple data check script to make sure that cost is always less than the retail amount. If Cost is greater, an alert pops up, "cost must be less." Thank you for any assistance. Quote Link to comment Share on other sites More sharing options...
Mathilda Posted January 6, 2017 Report Share Posted January 6, 2017 16 hours ago, lmooring said: Hi Caspio World, I feel like this is an easy one, but I am not able to figure out the java scripting. I have two fields on a submission form; Cost and Retail. I am looking for a simple data check script to make sure that cost is always less than the retail amount. If Cost is greater, an alert pops up, "cost must be less." Thank you for any assistance. Hi, try using my code in the footer of the datapage: <SCRIPT LANGUAGE="JavaScript"> function check() { var v_cost = parseFloat(document.getElementById("InsertRecordFirst_field").value); var v_retail = parseFloat(document.getElementById("InsertRecordSecond_field").value); if(v_cost>v_retail) { window.alert("Cost must be less"); return false; } } document.getElementById("caspioform").onsubmit=check; </SCRIPT> Replace First_field with field name where you store cost, and Second_field with field name where you store retail amount. Hope it helps! lmooring 1 Quote Link to comment Share on other sites More sharing options...
lmooring Posted January 6, 2017 Author Report Share Posted January 6, 2017 This worked perfect. Thank you!! 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.