Jump to content

Javascript for Minimum Maximum Value

Recommended Posts

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? 

Link to comment
Share on other sites

Hi steveruehlen,

please add header footer to the datapage, disable html editor and paste the following code in the footer:


 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!");




Insert your field name instead of "Field_name"

Hope it helps :)

Link to comment
Share on other sites

  • 1 year later...

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.

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.

  • Create New...