Help - Search - Members - Calendar
Full Version: Need Help with setting a Min Value for a Text Box
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
sirhavok
So what i have is a set off radio buttons, "a,b,c,d,e,f,g"

I also have a text box to enter a value needed of each radio button.

What I'm trying to figure out is how the hell do i make a min quantity for each one of my radio buttons.

Example

If A is selected, then min value for text box is 200

or

If B is selected, then min value for text box is 300

this is what i was coming up with so far, but i think i might be way off.

My Form Script
<form onsubmit=" if (Quantity2.value >= minQty.value) { alert('true'); return false; }" id="form1" name="form1" method="post" action="mail.asp">

My Radio Button Script
<input type="radio" name="LanyardStyle" value="Polyester" id="RadioGroup1_0" onChange="minQty.value=500" />

My Text Box Script
<input type="text" name="Quantity2" id="Quantity2" width="200" />

Any help would be greatly appreciated! thanks




Darin McGrew
Please see the FAQ entry How can I require that fields be filled in, or filled in correctly?
sirhavok
QUOTE(sirhavok @ Feb 10 2011, 11:26 AM) *

So what i have is a set off radio buttons, "a,b,c,d,e,f,g"

I also have a text box to enter a value needed of each radio button.

What I'm trying to figure out is how the hell do i make a min quantity for each one of my radio buttons.

Example

If A is selected, then min value for text box is 200

or

If B is selected, then min value for text box is 300

this is what i was coming up with so far, but i think i might be way off.

My Form Script
<form onsubmit=" if (Quantity2.value >= minQty.value) { alert('true'); return false; }" id="form1" name="form1" method="post" action="mail.asp">

My Radio Button Script
<input type="radio" name="LanyardStyle" value="Polyester" id="RadioGroup1_0" onChange="minQty.value=500" />

My Text Box Script
<input type="text" name="Quantity2" id="Quantity2" width="200" />

Any help would be greatly appreciated! thanks


Yea I was checking those out, but i kinda want something to tell them right away, not when they hit the submit button. Thats what i was trying to use the OnChange Attribute.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.