code below worked great but when I switch back and forth between car 1 and 2 the value didn't reset. ok, here the problem...
first select "One A" from car 1, hit submit, the values show below
Form Fields:
A=1
B=0
then select "One B" from car 2, hit submit, the values show below
Form Fields:
A=1
B=1
how can I reset the value of A=0 since the car 1 drop down is not visible at this time. Or can I just set the attribute for the hidden field to disable so it won't be pass to the next page?
thanks
<script>
$(document).ready(function() {
$("input[name$='reporttype']").click(function() {
var type = $(this).val();
$("div.desc").hide();
$("#Reporttype" + type).show();
});
});
</script>
car 1<input type="radio" name="reporttype" checked="checked" value="1" />
car 2: <input type="radio" name="reporttype" value="2" />
<div id="Cars1" class="desc">
A: <select name="a" id="com">
<option value="0" selected="selected">select one</option>
<option value="1">One A</option>
</select>
</div>
<div id="Cars2" class="desc" style="display: none;">
B: <select name="com" id="com">
<option value="0" selected="selected">select one</option>
<option value="1">One B</option>
</select>
</div>
<input type="submit" name="sbumit">