twitter bootstrap - Enclosing radio button with a label in Laravel -


To display the radio buttons correctly with the bootstrap framework, you have to put them in the label. Like this:

  & lt; Div class = "radio" & gt; & Lt; Label & gt; & Lt; Input type = "radio" name = "gender" id = "gender-male" value = "m" & gt; Men & lt; / Label & gt; & Lt; / Div & gt;  

I have tried to complete it with Laravel but I can only make the label a different element.

  & lt; Div class = "radio" & gt; {{Form: label ('gender-male', 'male')}} {{form :: radio ('sex', 'm', true, ['id' => 'gender-male']) }} & Lt; / Div & gt;  

Generates this HTML:

  & lt; Div class = "radio" & gt; & Lt; Label = "sex-male" & gt; Men & lt; / Label & gt; & Lt; Input id = "gender-male" check = "checked" name = "gender" type = "radio" value = "m" & gt; & Lt; / Div & gt;  

So what is the strategy here to get the HTML that matches the first code block?

Update

The way to be deceptive and to do it is:

  & lt; Label & gt; {{Form :: radio ('sex', 'm', true)}} men & lt; / Label & gt;  

But is there a better way?

Conclusion

There is no inherent way of doing this as stated by @LukasGuater, so the above construction is not necessarily "wrong". For third party ways, see the answers.

A useful contributor is a module that allows you to use this format:

{{form :: inline_labeled_radio ('radio', 'm', 'man')}}

installation instructions can be found

< / Div>

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -