입력 상자 위의 레이블에 오류가 표시 될 수있었습니다.
아래 코드를 사용하면 위치 지정 등의 형식으로 지정할 수있는 클래스에 오류가 발생했지만 입력 상자 아래에 빈 div 나 무언가가 항상 있으므로 그 아래에 다른 입력 상자가 있습니다. 관절. 내 이니셜 라이저에서
<%= f.input :name, :required => true, :label_html => { :class => 'edit_form_titles' }, :error_html => { :class => 'cant_be_blank'} %>
/simple_form.rb이 있었다 :
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.wrapper :tag => 'div', :class => 'controls' do |input|
input.use :input
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
input.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
end
내가이 변경 : 입력 상자와 나는 아래의 빈 빈 공간을 제거있어
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.wrapper :tag => 'div', :class => 'label-error' do |input|
b.use :label
b.use :error, :wrap_with => { :tag => 'span', :class => 'help-block' }
end
b.wrapper :tag => 'div', :class => 'controls' do |ba|
ba.use :input
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
end
내 레이블의 텍스트 옆에 텍스트가 정확히 표시되도록 cant_be_blank 클래스 형식을 지정할 수 있습니다.