Prototype JS - form elements need names, not just IDs
Jun 6, 2008
javascript
This post is more than 18 months old. Since technology changes too rapidly, this content may be out of date (but
that's not always the case). Please remember to verify any technical or programming information with the current
release.
So, I got stuck on this bug for an hour - so I thought I’d write it down.
I was using prototype js’s serialize command on a form. I was also using a strict xhtml doctype. My form elements had IDs only - and did not have names. Well, serialize kept coming back empty. Turns out that prototype requires there to be names on each of the elements.
UPDATE: Der - according to W3C, the name
attribute of the form
tag is deprecated, not the name attribute of the form elements…
hits head with hand