scoob
07-29-2003, 04:20 AM
When you use the same name with a [] for multiple fields (hidden and text), the result is concatenated. Because of the shopping cart I use (mals-e.com), I have to use this technique.
But I'm having difficulting doing some form validation on those product2[] elements (see code below).
I'd like to have a "onsubmit" javascript event handler
tied to the form that could verify that if the user has
clicked on the checkbox (qty2), then he MUST have entered
an account number in product2[] (the 4th on that is!).
I don't do javascript and this is only giving me a headache
in trying to figure out how to reference this particular
DOM form object in the verification function.
Any javascript code example would be greatly appreciated!
.... stuff deleted ....
<input type="hidden" name="product2[]" value="Use my Shipping (10% off)">
<input type="checkbox" name="qty2" value="1">
<input type="hidden" name="price2" value="-4.80">
<select size="1" name="product2[]"
<option value="Fedex">Fedex</option>
<option value="UPS">UPS</option>
<option value="DHL">DHL</option>
<option value="Airborne">Airborne</option>
</select>
<i>account#</i>
<input type="hidden" name="product2[]" value="acct #">
<input type="text" name="product2[]" size="20" >
.... stuff deleted ....
Cheers!
- Christian
But I'm having difficulting doing some form validation on those product2[] elements (see code below).
I'd like to have a "onsubmit" javascript event handler
tied to the form that could verify that if the user has
clicked on the checkbox (qty2), then he MUST have entered
an account number in product2[] (the 4th on that is!).
I don't do javascript and this is only giving me a headache
in trying to figure out how to reference this particular
DOM form object in the verification function.
Any javascript code example would be greatly appreciated!
.... stuff deleted ....
<input type="hidden" name="product2[]" value="Use my Shipping (10% off)">
<input type="checkbox" name="qty2" value="1">
<input type="hidden" name="price2" value="-4.80">
<select size="1" name="product2[]"
<option value="Fedex">Fedex</option>
<option value="UPS">UPS</option>
<option value="DHL">DHL</option>
<option value="Airborne">Airborne</option>
</select>
<i>account#</i>
<input type="hidden" name="product2[]" value="acct #">
<input type="text" name="product2[]" size="20" >
.... stuff deleted ....
Cheers!
- Christian