Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 8/26/2011

Max Brunsfeld
Saturday, August 27, 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.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

One comment

  1. Toby says:

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

    http://www.w3.org/TR/html4/interact/forms.html#adef-value-INPUT

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

    http://www.w3.org/TR/html4/interact/forms.html#initial-value

    August 27, 2011 at 4:06 pm

Add New Comment Cancel reply

Your email address will not be published.

Max Brunsfeld

Max Brunsfeld
San Francisco

Recent Posts

  • what, CI Reporter?
  • No go on #nogo
  • Super secret special standup
Subscribe to Max's Feed

Author Topics

backbone (1)
javascript (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >