gem 'rails', '4.0.8'
gem 'simple_form', '~> 3.1.0.rc1', github: 'plataformatec/simple_form', branch: 'master'
gem 'bootstrap-sass', '3.1.1'
View code
config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'col-sm-2 control-label'
b.wrapper tag: 'div', class: 'col-sm-10' do |ba|
ba.use :input, class: 'form-control'
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
## how change this
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
## to if has error
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block-hidden', style: 'display: none;' }
end
end
Example source code to be generated:
Before error - Show hint:
<p class="help-block">Login de acesso ao sistema</p>
During error - Hide hint
<p style="display: none;" class="help-block-hidden">Login de acesso ao sistema</p>
Must exist other ways, but would like the SimpleForm