View Full Version : How to submit checkboxes with the same name?

18 Feb 2010, 10:41 PM

in pure html, we can use some checkboxes with the same name like this:

<input type="checkbox" name="chk" value=1/>
<input type="checkbox" name="chk" value=2/>
<input type="checkbox" name="chk" value=3/>
<input type="checkbox" name="chk" value=4/>
<input type="checkbox" name="chk" value=5/>

if i check 1,2,3 and submit the form,i can get the chk in server side with the value "1,2,3"

but if i use the chekboxes with the same name in the extjs,i can only get the last chk value 3 in server side.

how should i do that i can submit the chechboxes like in pure html form?

19 Feb 2010, 7:05 AM
Off the top of my head I think you need to use the CheckBoxGroup class to pull this off. You may have to override the getValues method but I seem to recall that Ext will promote the checkboxes to an array. Give it a try. If it doesn't work then override the getValues method to return what you want fromt he group.

Hope that helps.