Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Make button_tag more helpful #189

wants to merge 2 commits into


None yet
2 participants

tomstuart commented Feb 12, 2011

The button_tag helper isn't very helpful at the moment for two reasons:

  • it defaults the type attribute to "button", which is unexpected since type="submit" is HTML's default for the <button> element; and
  • it doesn't take a block, but the main reason to use <button> (instead of <input type="submit"> et al) is that you want to include styled text or other elements like images.

These two commits fix the implementation, tests and docs for these two issues respectively.

tomstuart added some commits Feb 12, 2011

@tomstuart tomstuart Make type="submit" the default for button_tag helper
"submit" is the default value of the <button> element's type attribute
according to the HTML 4.01 and the HTML5 draft specs, so if button_tag
is going to have a default, type="submit" is a more sensible choice than

@tomstuart tomstuart Add block support to button_tag helper
As per the HTML 4.01 spec:

  Buttons created with the BUTTON element function just like buttons
  created with the INPUT element, but they offer richer rendering
  possibilities: the BUTTON element may have content. For example, a
  BUTTON element that contains an image functions like and may resemble
  an INPUT element whose type is set to "image", but the BUTTON element
  type allows content.

Since rich content is the main purpose of the <button> element, it makes
sense for the button_tag helper to accept a block.


spastorino commented Feb 12, 2011

Pushed thanks.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment