Fahim Patel
2013-Jan-16 04:41 UTC
how to handle error message when condition break both presence and numerical validation ?
Hi all, I have one numeric field "age" and it have two validation presence and numerical true. When i click submit without filling any value then i face error message is "is not number" ,but error message should be "is should be presence". How to set this message? Both the condition are satisfying. Did i have to configure en.yml ? Thanks Fahim -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Bz2IOd8dFO8J. For more options, visit https://groups.google.com/groups/opt_out.
Dheeraj Kumar
2013-Jan-16 05:04 UTC
Re: how to handle error message when condition break both presence and numerical validation ?
1. Why do you have two presence validators? 2. add allow_blank: true to the numerical validator. -- Dheeraj Kumar On Wednesday 16 January 2013 at 10:11 AM, Fahim Patel wrote:> > Hi all, > > I have one numeric field "age" and it have two validation presence and numerical true. > When i click submit without filling any value then i face error message is "is not number" ,but error message should be "is should be presence". How to set this message? > Both the condition are satisfying. > > Did i have to configure en.yml ? > > Thanks > > Fahim > > > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Bz2IOd8dFO8J. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Fahim Patel
2013-Jan-16 05:15 UTC
Re: how to handle error message when condition break both presence and numerical validation ?
Thanks for reply Let me try this, then i will reply you updated . Fahim On Wednesday, January 16, 2013 10:34:42 AM UTC+5:30, Dheeraj Kumar wrote:> > 1. Why do you have two presence validators? > 2. add allow_blank: true to the numerical validator. > > -- > Dheeraj Kumar > > On Wednesday 16 January 2013 at 10:11 AM, Fahim Patel wrote: > > > Hi all, > > I have one numeric field "age" and it have two validation presence and > numerical true. > When i click submit without filling any value then i face error message is > "is not number" ,but error message should be "is should be presence". How > to set this message? > Both the condition are satisfying. > > Did i have to configure en.yml ? > > Thanks > > Fahim > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> > . > To unsubscribe from this group, send email to > rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/Bz2IOd8dFO8J. > For more options, visit https://groups.google.com/groups/opt_out. > > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/jsnY7wtEPZUJ. For more options, visit https://groups.google.com/groups/opt_out.
Fahim Patel
2013-Jan-16 05:23 UTC
Re: how to handle error message when condition break both presence and numerical validation ?
No, your not getting my question , actually i want presence and numeric validation on "Age" field. When i click submit without filling any value then i face error message is "is not number" ,but error message should be "is should be presence". How to set this message? Hope you understood issue. On Wednesday, January 16, 2013 10:45:22 AM UTC+5:30, Fahim Patel wrote:> > Thanks for reply > Let me try this, then i will reply you updated . > > Fahim > > On Wednesday, January 16, 2013 10:34:42 AM UTC+5:30, Dheeraj Kumar wrote: >> >> 1. Why do you have two presence validators? >> 2. add allow_blank: true to the numerical validator. >> >> -- >> Dheeraj Kumar >> >> On Wednesday 16 January 2013 at 10:11 AM, Fahim Patel wrote: >> >> >> Hi all, >> >> I have one numeric field "age" and it have two validation presence and >> numerical true. >> When i click submit without filling any value then i face error message >> is "is not number" ,but error message should be "is should be presence". >> How to set this message? >> Both the condition are satisfying. >> >> Did i have to configure en.yml ? >> >> Thanks >> >> Fahim >> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/Bz2IOd8dFO8J. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Ur0U082IE4YJ. For more options, visit https://groups.google.com/groups/opt_out.
Priya D.
2013-Jan-16 08:10 UTC
Re: how to handle error message when condition break both presence and numerical validation ?
Try giving the following. validates :age, :numericality => true, :allow_nil => true This validation will not be invoked if the age is not present. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Fahim Patel
2013-Jan-16 08:49 UTC
Re: how to handle error message when condition break both presence and numerical validation ?
Thanks It works... Best Regards Fahim On Wednesday, January 16, 2013 1:40:38 PM UTC+5:30, Ruby-Forum.com User wrote:> > Try giving the following. > > validates :age, :numericality => true, :allow_nil => true > > This validation will not be invoked if the age is not present. > > -- > Posted via http://www.ruby-forum.com/. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/k2hXC7rlDJwJ. For more options, visit https://groups.google.com/groups/opt_out.