you are giving :maxlength=>5 in form rite? y cant u give the :maximum => 5 in ur model , dat would wrk i think so.
On Nov 16, 4:52 am, "Todd A. Jacobs" <tjacobs-sndr- [email protected]> wrote: > I have a model that includes the following: > > validates_presence_of :zipcode > validates_numericality_of :zipcode, :plus4, :allow_nil=>true > validates_length_of :zipcode, :is=>5, :allow_nil=>true > validates_length_of :plus4, :is=>4, :allow_nil=>true > > The allow_nils are just to prevent the reporting of the same error (say, > a missing zipcode) multiple ways. The problem is that, when the user > enters data into the form: > > <%= f.label :zipcode %>: > <%= f.text_field :zipcode, :maxlength=>5 %>-<%= f.text_field :plus4, > :maxlength=>4 %> > > the validation reports: > > Zipcode is the wrong length (should be 5 characters) > > even when the input *is* five digits (e.g. "99999"). What's going on > here? > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

