On May 26, 2005, at 11:59 AM, Alex Brelsfoard wrote:
> Yeah, but still we need to remember to put that hidden field in to
> hold
> the place of the checkbox's name.
> Part of my problem is that there are MANY differen humans who are
> making
> forms who use my script. WAY too much human error availability. My
> helper script that reads the HTML to create a list of fields is a bit
> safer (though still not the answer I'm looking for).
> <shrug>
> --Alex
If you are able to control the enclosing form tag and count on
javascript (uh, hmmm, well...), then you could pack the field names
into a string and submit it like this:
<!-- apologies in advance for hijacking some bandwidth for javascript
-->
<script>
function collect_names (form_name, element_name) {
var names = new Array();
for (var i = 0; i < document.forms[form_name].elements.length; +
+i) {
if (document.forms[form_name].elements[i].name) {
names.push(document.forms[form_name].elements[i].name);
}
}
document.forms[form_name].elements[element_name].value =
names.join(',');
}
</script>
<form name="form1" method="get" onsubmit="collect_names('form1',
'all_field_names')">
<input type="hidden" name="all_field_names" value="">
<input type="checkbox" name="sign_me_up">
<input type="checkbox" name="flame">
<input type="checkbox" name="douse">
<input type="submit" value="Go">
</form>
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm