Rails Validations neat errors in form -


so made validation check gender if accurate id number inputted, if data incorrect error appear beneath select within form.

.col   %h4 participant   = f.field(:full_name, :label => "full name *")   = f.field(:id_number)   = f.field(:gender, :field_type => :select, :choices => gender_select, :label => 'gender *')   %br #note added 'hacky' fix   = f.field(:race, :field_type => :select, :choices => race_select, :label => 'race *') 

without %br have form return error this

enter image description here

is there less hacky way when error displayed renders this. errors don't overflow onto other form elements

%br = participant.errors[:gender] %br 

.field-error     = participant.errors[:gender] 

then use css style field-error class.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -