steveruehlen Posted June 20, 2016 Report Share Posted June 20, 2016 I have a currency field in a table and I am using a Submission form to enter new records into that table. I want to keep users from entering a value higher than $75,000 in the currency field when using the Submission form. I also want to set a minimum value. I considered using a lookup field with fixed values, but quickly determined the min/max range is too wide ($5,000 - $75,000) because I would need to include values for $5,000.00, $5,000.01, $5,000.02 and so on, all the way up to $75,000. The answer then is using Javascript. Does anybody have the code that will match data entered into the currency field against a minimum and maximum value? Quote Link to comment Share on other sites More sharing options...
Mathilda Posted June 21, 2016 Report Share Posted June 21, 2016 Hi steveruehlen, please add header footer to the datapage, disable html editor and paste the following code in the footer: <SCRIPT LANGUAGE="JavaScript"> function check() { var v_sales = parseFloat(document.getElementById("InsertRecordField_name").value); if(v_sales >75000) { window.alert("Too large.. Please enter value smaller than 75 000"); return false; } else if(v_sales <5000) { window.alert("Too small.. Please enter value bigger than 5 000"); return false; } else { window.alert("Thank you.. Information is registered!"); } } document.getElementById("caspioform").onsubmit=check; </SCRIPT> Insert your field name instead of "Field_name" Hope it helps Quote Link to comment Share on other sites More sharing options...
steveruehlen Posted June 21, 2016 Author Report Share Posted June 21, 2016 Hi Mathilda. Thank you, this works as it should. Unfortunately, this brings up a pop-up box that allows the user to dismiss future alerts. Is there code that would allow me to display this message within the form? Thanks! Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 21, 2016 Report Share Posted June 21, 2016 add HTML Block and this code: <div id="msg"></div> then instead of each window.alert you can have document.getElementById('msg').innerHTML = "Too small.. Please enter value bigger than 5 000"; Quote Link to comment Share on other sites More sharing options...
NeoInJS Posted March 21, 2018 Report Share Posted March 21, 2018 May I please ask your help how can this be implemented in a Tabular DataPage when editing a record? 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.