<p>I have a form that contains a bunch of checkboxes.  Before submitting the form, I'd like to grab the values of the checkboxes and stick them into a text field, then submit that.</p>

<p>So I might have:
   Red
   Orange
X  Yellow
   Blue
X  Green</p>

<p>And I'd like my textfield to end up with the content "Yellow, Green" .  </p>

<p>This doesn't seem too complicated, but I am totally out of my league.  I already use jQuery for a few other things so I have the framework ready, if that makes it easer.</p>

<p>Thanks for any advice --</p>

First hack at it (without testing):
```
```
var serializedCheckboxes = '';
$("input type='checkbox'").each(function() {
 if($(this).attr("checked")) {
  serializedCheckboxes += $(this).attr("value") + ',';
 }
});

$("input name='allchecks').attr("value", serializedCheckboxes);
```
```