问题
I've a list of checkboxes that get rendered out using javascript.
<input type="checkbox" name="sportType" id="sportType11" value="11" />Golf
<input type="checkbox" name="sportType" id="sportType12" value="12" />Tennis
<input type="checkbox" name="sportType" id="sportType13" value="13" />Football
<input type="checkbox" name="sportType" id="sportType14" value="14" />Cricket
On submitting the form I can pickup the selected values in ASP.NET by using:
Request.Form["sportType"]
In firefox this works and returns something like 11,12,13,14 (Assuming all are checked)
In IE however it returns on,on,on,on
Has anyone encountered this before and hopefully solved it?
Thanks
Having dug a little deeper I've discoved that in IE Jquery render the input box like so:
<input propdescname="sportType" id="sportType11" type="checkbox" jQuery1288622120804="10" value="on"/>
Which give explains the on,on,on value thats been retured? Can anyone shed any light on how to correct this, I assume jquery does this so it can consistantly keep track of selected checkboxes.
Thanks
Kevin
Solved, kind of
Value of jQuery generated checkbox in IE8 is stored as "on" rather than actual value?
回答1:
Try changing the name to name="sportType[]" and see what happens, what I would do in PHP at least.
来源:https://stackoverflow.com/questions/4069598/jquery-checkbox-list-problem-in-ie-values-saved-as-on-on-on-should-be-10-12-13