Firstly, I am a newbie here, so please bear with me as I clumsily get around.
Secondly, I am the Website Manager for my company, Exeter Fuel (www.exeterfuel.com). I am not a programmer by any means, but a writer who's been requested to handle managing the site, so I am learning and if I am in the wrong place for this, please let me know!
Now, if you are still with me, I need to know how to do a certain task for one of my webpages. It is an order online page which asks a number of questions. One of the specifications for ordering calls for a quantity of fuel (in gallons) requested. I currently have a text box for that, but my boss wants to make sure they can't enter any number less than a minimum. For example, to order home heating oil the required minimum is 100 gals. Is there any javascript available that could take whatever the user entered and compare that to the minimum and kick back a message saying they must enter something equal to or greater than 100 if it's less than 100? I hope that question makes sense! I have checked the JavaScriptSource website, but can't seem to find anything that might work.
Notice the Red, that is what I changed. Put that in each text box declaration (change 500 to the minimum number of gallons). Then, here is the function that goes in the head
Code:
function checkMin(min, input, obj){
if (obj.value != ""){
if (input < min){
alert('You must fill at least ' + min + ' gallons');
obj.select();
}
}
}
If the text box is not blank, it reads the value and if it's less than the min, it tells the user they must input at least the min, then it selects the text. Hope this helps you out.
Bookmarks