Dan Harper
2007-Mar-15 15:12 UTC
Form Validation without a Model (Showing the users input when validation fails)
Hi all, I''m writing a Advanced Search form which is not attached to a model and I''m wondering if there''s an easy way to re-show the the form to the user with their inputted values shown back to them if validation fails. Example: 1. user fills in the search text field with "Dan" 2. user hits submit 3. the user forgot to select a value from a drop down box (eg search on first name) 4. renders the form with the error message added to flash 5. form is blank! Of course this works (the users'' inputted values are re-shown) for form helpers that are based on a model, but what if it''s a form like a search form? Cheers, Dan --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tyler MacDonald
2007-Mar-15 15:21 UTC
Re: Form Validation without a Model (Showing the users input when validation fails)
This looks like a pretty good solution: http://agilewebdevelopment.com/plugins/activerecord_base_without_table Cheers, Tyler Dan Harper <dan-PgyDRTk+LdNrovVCs/uTlw@public.gmane.org> wrote:> > Hi all, > > I''m writing a Advanced Search form which is not attached to a model > and I''m wondering if there''s an easy way to re-show the the form to > the user with their inputted values shown back to them if validation > fails. > > Example: > 1. user fills in the search text field with "Dan" > 2. user hits submit > 3. the user forgot to select a value from a drop down box (eg > search on first name) > 4. renders the form with the error message added to flash > 5. form is blank! > > Of course this works (the users'' inputted values are re-shown) for > form helpers that are based on a model, but what if it''s a form like > a search form? > > Cheers, > Dan > > > > >-- --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---