0

In Rails is it possible to achieve an HTML output like this using button_to?

<button type="submit" value="1" name="id">Type 1</button>
<button type="submit" value="2" name="id">Type 2</button>

What are the reasons for using button_to over manually entering the HTML in my form?

...

EDIT:

Perhaps I should rephrase this? Seems the better way would be to add some hidden fields to the button_to form. It doesn't seem like I can do this.

So what is the correct Rails solution to pass extra hidden fields to a dynamic form generated via a button_to? Or should I just build a form manually?

e.g. I have:

button_to "Download", items_path(:release_id => release), :remote => true

and I want to pass an extra parameter in the form POST format => "download"

benedict_w
  • 3,543
  • 1
  • 32
  • 49

1 Answers1

0

Seems my answer was to use the form_tag helper

benedict_w
  • 3,543
  • 1
  • 32
  • 49