vendredi 2 décembre 2016

Add custom class to simple_form_for association of type option - Rails

I'm using a simple_form_for with a association

= f.association :type, :collection =>version_name,:label => "Application type:", :selected =>'', :item_wrapper_class => 'lbl_type'

This generates a html like below,

<div class="control-group select optional">
<label class="select optional control-label" for="subscription_type_id">Application type:</label>
<div class="controls">
<select class="select optional control-label" id="subscription_type_id" name="subscription[type_id]">
<option value="4">Type 1</option>
<option value="5">Type 2</option>
</select>
</div>
</div>

I tried with item_wrapper_class but it is not working

How to add specific custom classes to the control-label and to the input field

Is there any way I can achieve this?

Aucun commentaire:

Enregistrer un commentaire