Ruby on Rails Monday, June 9, 2014

On Jun 9, 2014, at 6:35 AM, Ronald Fischer wrote:

> Walter Davis wrote in post #1148961:
>> Look at the generated HTML in a browser. In order for the label to
>> affect the radio button, one of two things must be true:
>>
>> 1. Either the label's "for" attribute exactly matches the radio button's
>> "id" attribute, or
>
> Got it! I now can see my mistake. The label should be
>
> <%= d.label :filtertype_lefteq, 'Starts with...', value: 'lefteq' %>
>
>> 2. The label wraps around the button and does not have a "for"
>> attribute.
>
>
> Just out of curiosity: How can *that* be done inside an ERB file?

<%= f.label :your_element do %>
<%= f.check_box :your_element %>
The label text for your element
<%- end %>

That creates a wrapped label. I use this all the time, particularly when making a Bootstrap layout.

Walter

>
> Ronald
>
> --
> 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/f65c4a2420c35a32b3668128d54b120d%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

--
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/B925CE59-E315-41D7-9BEA-6F3313C4AD97%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment