When using form.serialize, it also includes disabled elements. Would
it be possible to alter future versions of prototype to not include
disabled elements, or have an option not to include disabled elements.
Is there a trac(or similar program) for prototype?
<!-- Test HTML --?>
<form id="myForm">
<input name="one" />
<input name="two" />
<input name="three" />
<input name="four" disabled="disabled" />
</form>
<script>
alert(Form.serialize($('myForm')));
</script>
<!-- Our Fix -->
Form.Element.Methods = {
serialize: function(element) {
element = $(element);
if (element.disabled == true) {
return;
}
var method = element.tagName.toLowerCase();
var parameter = Form.Element.Serializers[method](element);
if (parameter) {
var key = encodeURIComponent(parameter[0]);
if (key.length == 0) return;
if (parameter[1].constructor != Array)
parameter[1] = [parameter[1]];
return parameter[1].map(function(value) {
return key + '=' + encodeURIComponent(value);
}).join('&');
}
},
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---