2013-06-28 39 views
0

我試圖創建一個內聯顯示無線電選項像這樣的形式:在線單選按鈕引導

Ø蘋果ØMicrosoft操作系統的Twitter O方形

目前我有這樣一行:

<%= f.association :company, as: :radio, label: false %> 

但我的形式是這樣的:

Ø蘋果
Ø微軟
ØTwitter的
O方形

我已經試過<div class="form-inline"></div>周圍的輸入,並且還加入

<%= f.association :company, as: :radio, label: false, :item_wrapper_class => 'inline' %> 

我需要輸入改爲徵收?

+0

可能重複\ _form \ _for rails單選按鈕內聯](http://stackoverflow.com/questions/9985317/simple-form-for-rails-radio-button-inline) –

+1

This在simplee_form的結尾仍然是一項工作。這是談論這個問題的要點:https://github.com/plataformatec/simple_form/issues/857 最新的simple_form.rb在2天前更新。希望在一兩週內,所有的更新都會被測試併合並回主站。然後,它會再次美麗。 –

回答

-2

您可以使用此:

<label class="checkbox inline"> 
    <input type="checkbox" id="inlineCheckbox1" value="option1"> 1 
</label> 
<label class="checkbox inline"> 
    <input type="checkbox" id="inlineCheckbox2" value="option2"> 2 
</label> 
<label class="checkbox inline"> 
    <input type="checkbox" id="inlineCheckbox3" value="option3"> 3 
</label> 

或者這一個(標籤唯一形式):

<form class="form-inline"> 
    <input type="text" class="input-small" placeholder="Email"> 
    <input type="password" class="input-small" placeholder="Password"> 
    <label class="checkbox"> 
    <input type="checkbox"> Remember me 
    </label> 
    <button type="submit" class="btn">Sign in</button> 
</form> 
+0

試試這個<%= f.radio_button(:option,「option1」)%> <%= f.label(:option_option1,「option 1」)%> <%= f.radio_button(:option,「option2 「)%> <%= f.label(:option_option2,」option 2「)%> – ClaudioZ

+0

感謝您的回答,但即時嘗試使用simple_form – emailnitram

0

與普通鐵軌,你可以做[簡單的

<div class="radio"> 
    <label> 
     <%= radio_button_tag "Product Type", "Retail Product or Service", true %> 
     Retail Product or Service 
    </label> 
    <label> 
     <%= radio_button_tag "Product Type", "Tax Code", false %> 
     Tax Code 
    </label> 
    <label> 
     <%= radio_button_tag "Product Type", "Discount Amount", false %> 
     Discount Amount 
    </label> 
    <label> 
     <%= radio_button_tag "Product Type", "Discount Percent", false %> 
     Discount Percent 
    </label> 
    </div>