Ruby on Rails Tuesday, September 1, 2015

Walter Davis wrote in post #1178402:
>> However, it did not work. Here is my code in my file.
>>
>> <%= form_for @subscription do |f| %>
>> <%= f.text_field :email %>
>> <%= f.submit %>
>> <% end %>
>>
>
> When you view that in a browser, what do you see?
>
> Bootstrap 3 doesn't require a classname on the form element itself any
> more, unless you want to do an inline form, in which case you need to
> add class="form-inline" to it. To do that in a standard Rails form_for
> helper, set that in the html: attributes:
>
> <%= form_for :foo, html: { class: 'form-inline' } %>
>
> The rest (form-group and similar) can be done easily with regular HTML
> inside the form partial, and you can add a classname to a form element
> like this:
>
> <%= f.text_field :bar, class: 'form-control' %>
>
> Walter

Thanks Walter.

I tried this below it change the submit button text. However, the
styling of the button is not be applied. Am I leaving something wrong or
leaving somtehing off.

<%= form_for @subscription do |f| %>
<%= f.text_field :email %>
<div class="form-group">
<%= f.submit "Update", class: "btn btn-primary" %>
</div>
<% end %>


Example - I tested..
The tried this code below as a test and it works. But, it does not
contain the ruby code.
<form class="form-inline">
<div class="form-group">
<input type="email" class="form-control" id="exampleInputEmail1"
placeholder="Email Address">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4a58aa8b9545e546f11fe0cac1580789%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment