killebytes
killebytes

Reputation: 980

padrino - adding html options to submit button on button_to

button_to 'Submit',url(:account, :login) 

generates form like this:

<form action="/account/login" method="post">
    <input type="submit" value="Submit">
</form>

but I want to generate something like this:

<form action="/account/login" method="post">
    <input type="submit" value="Submit" class="myclass">
</form>

Upvotes: 0

Views: 621

Answers (2)

ujifgc
ujifgc

Reputation: 2255

Many of tag helpers can receive a block to capture inner html:

button_to 'Submit', url(:base, :index) do
  submit_tag 'Submit', :class => 'myclass'
end

Upvotes: 2

Michael Frederick
Michael Frederick

Reputation: 16714

I believe that this should work:

<%= button_to 'Submit', {:controller => :account, :action => :login}, :class => 'myform' %>

The third parameter to button_to is html_options. If you can only alter the form using the html_options, then you could use a css selector like this:

form.myform input {} 

Upvotes: 0

Related Questions