troubleshooting Question

Verify select option is selected using db generated select option name variable in javascript

Avatar of zizzz
zizzzFlag for United States of America asked on
Web Languages and StandardsJavaScriptWeb DevelopmentMySQL ServerScripting Languages
13 Comments1 Solution784 ViewsLast Modified:
Hi

I need help with the selection object in js.

thx

Perl form will pull info form mysql db
put in html form. The "$ID" is generated from the mysql db and concatenate with "-Car". We alsways have more than one select option form field.

<form name='form1'>
Car field:
<select name="$ID-Car" size="1">
<option value="c1">car 1</option>
<option value="c2">car 2</option>
<option value="c3">car 3</option>
</select>

<select name="$ID-Car" size="1">
<option value="c1">car 1</option>
<option value="c2">car 2</option>
<option value="c3">car 3</option>
</select>


Age field:

<select name="$ID-AgeGroup" size="1">
<option value="teen">teen</option>
<option value="adult">adult</option>
<option value="senior">senior</option>
</select>

<select name="$ID-AgeGroup" size="1">
<option value="teen">teen</option>
<option value="adult">adult</option>
<option value="senior">senior</option>
</select>

Payment field:

<select name="$ID-Payment" size="1">
<option value="1500">teen</option>
<option value="1000">adult</option>
<option value="1500">senior</option>
</select>

<select name="$ID-Payment" size="1">
<option value="1500">teen</option>
<option value="1000">adult</option>
<option value="1500">senior</option>
</select>
</form>

First, I would like to be able to verify that at least one selection is selected and give error if none is selected
Second, If one of the Car is selected than the Age group must be selected, if not thatn give error.
Third, when car and age are selected then the price must be shown in the payment field.
Payment field can be re-arranged as "text field" if it is easier.

Thx

Jason
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros