Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 8/26/2011

Interesting Things

  • Radio buttons behave strangely when they have no ‘value’ attribute. If you had a form containing a tag like this:

<input type="radio" name="foo" /> (no value attribute),

and you selected that radio button, then the POST data will contain foo=on. The default value is not an empty string, but the word “on”.

You might run into this problem using rails form helpers. If you pass a nil value to ActionView’s radio_button_tag method, it will render a tag without a ‘value’ attribute, so the string “on” might show up in your params.

  • Watch out for old middleware that expects the :body method of a Rack::Response to return a string. In newer versions of rack, the method returns an enumerable. We ran into this problem with an old version of pdfkit. It’s fixed in the new version.

  1. Toby says:

    Radio buttons are required to have a value set, so if there is no value set then the value is undefined.

    “on” is the “sane” implementation of this undefined behavior, because a selected radio button is “on” and the others are “off”.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *