TomGuy
01-12-2004, 11:01 AM
Hi,
I'm new to the world of javascript and I'm having a bit of a problem with my onblur event. I have two fields in a form (a text box and a hidden object). The hidden object's value contains the minimum value allowed to be entered into the text box. Therefore on the textbox "OnBlur" event I want to make sure that the number they entered into the textbox is greater than the minimum value contained in the hidden object...hopefully this will make sense after you look at my code:
**JavaScript**
function CheckQty(DesiredQty, MinQty)
{
//The following alert box is used for testing - the DesiredQty
comes back with whatever was entered into the textbox
however the MinQty comes back as "undefined"
alert(DesiredQty.value + MinQty.value);
if (DesiredQty.value < MinQty.value)
{
alert('You have entered a number below the minimum Quantity. Please adjust your desired quantity.');
return 0;
}
}
**HTML**
<FORM NAME="dspProducts">
<INPUT TYPE="hidden" NAME="hidMinQty" value="5">
<INPUT TYPE="TEXT" NAME="makeQty"
onblur="CheckQty(document.dspProducts.makeQty, document.dspProducts.hidMinQty)">
It may be that this event doesn't support calling two fields...Not sure....If that's the case can anyone think of a different way to handle this?
Thanks!
Tom
I'm new to the world of javascript and I'm having a bit of a problem with my onblur event. I have two fields in a form (a text box and a hidden object). The hidden object's value contains the minimum value allowed to be entered into the text box. Therefore on the textbox "OnBlur" event I want to make sure that the number they entered into the textbox is greater than the minimum value contained in the hidden object...hopefully this will make sense after you look at my code:
**JavaScript**
function CheckQty(DesiredQty, MinQty)
{
//The following alert box is used for testing - the DesiredQty
comes back with whatever was entered into the textbox
however the MinQty comes back as "undefined"
alert(DesiredQty.value + MinQty.value);
if (DesiredQty.value < MinQty.value)
{
alert('You have entered a number below the minimum Quantity. Please adjust your desired quantity.');
return 0;
}
}
**HTML**
<FORM NAME="dspProducts">
<INPUT TYPE="hidden" NAME="hidMinQty" value="5">
<INPUT TYPE="TEXT" NAME="makeQty"
onblur="CheckQty(document.dspProducts.makeQty, document.dspProducts.hidMinQty)">
It may be that this event doesn't support calling two fields...Not sure....If that's the case can anyone think of a different way to handle this?
Thanks!
Tom