validates_format_of :message not working, validates_length_of :too_long is working.

45 views
Skip to first unread message

tomkins

unread,
Aug 14, 2012, 8:30:33 AM8/14/12
to hobo...@googlegroups.com
I'm using validates_format_of and the validation I want to do works, but I cannot get an error message to be displayed if the data is invalid:
validates_format_of :mobile, :with => /\A[\+0-9]+\Z/, :message => " - Wrong"

I have another validation some where else that does display the error message: " - Name is too long"
validates_length_of :name, :within => 5..40, :too_long => " - Name is too long",

validates_length_of :name, :within => 1..50, :message => "Broken"  <------ This also works but not for validates_format_of

Any ideas?
Thanks.

Bryan Larsen

unread,
Aug 14, 2012, 9:11:58 AM8/14/12
to hobo...@googlegroups.com
validation messages are rendered by the error-messages tag.
Normally, this tag is included into your pages via the form tags
defined in app/views/taglibs/auto/rapid/forms.dryml.

I suspect that you have redefined your form tag without including the
error-messages tag. If so, just add the error-messages tag to your
page or form somewhere.

Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/M5j7nh5xCbEJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

tomkins

unread,
Aug 14, 2012, 9:23:59 AM8/14/12
to hobo...@googlegroups.com
Perfect, thanks.
Reply all
Reply to author
Forward
0 new messages