Erwin
2009-Jun-28 15:55 UTC
validation error messages in Form - how to disable the ActionView::Base.field_error_proc ?
I wrote the following code in my form view : <li><label for="email">Email</label> <%= form.text_field :email, :size => "30" %> <span id=''email_error'' class=\''warning-text warning-text-indent\''><%@user.errors.on(:email) %></span></li> the generated html code is the following : <span class="field-with-errors"><input type="text" value="" size="30" name="user[email]" id="user_email"/></span> <span warning-text-indent\="" class="\''warning-text" id="email_error">should look like an email address.is too short (minimum is 6 characters)</span> it''s not far from what I would like : ( getting rid of the <span class="field-with-errors"> ) <input type="text" value="" size="30" name="user[email]" id="user_email"/> <span warning-text-indent\="" class="\''warning-text" id="email_error">should look like an email address.is too short (minimum is 6 characters)</span> is there any way to disable the ActionView::Base.field_error_proc in the config file ?
Frederick Cheung
2009-Jun-28 16:03 UTC
Re: validation error messages in Form - how to disable the ActionView::Base.field_error_proc ?
On Jun 28, 11:55 am, Erwin <yves_duf...-ee4meeAH724@public.gmane.org> wrote:> > is there any way to disable the ActionView::Base.field_error_proc in > the config file ?You could set ActionView::Base.field_error_proc to a proc that is just a no-op. Fred
erwin
2009-Jun-28 21:01 UTC
Re: validation error messages in Form - how to disable the ActionView::Base.field_error_proc ?
Thanks Fred I''ll try additional Q: when multiple errors on the same field, writing : <span id=''email_error'' class=\''warning-text warning-text-indent\''><%@user.errors.on(:email) %></span> produce a concatenated string like : is too short (minimum is 6 characters)should look like an email address.is too short (minimum is 3 characters)should use only letters, numbers, spaces, and .-_@ please. how can I get ''return'' inserted between each error ? is too short (minimum is 6 characters) should look like an email address. is too short (minimum is 3 characters)should use only letters, numbers, spaces, and .-_@ please this is what field_error_proc helper is doing , I guess, but I am not so experienced to rewrite it ... On 28 juin, 18:03, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jun 28, 11:55 am, Erwin <yves_duf...-ee4meeAH724@public.gmane.org> wrote: > > > > > is there any way to disable the ActionView::Base.field_error_proc in > > the config file ? > > You could set ActionView::Base.field_error_proc to a proc that is just > a no-op. > > Fred