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
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
Post a Comment