Hi, I''m relatively new to Ruby on Rails. I''ve searched and can''t find a straightforward answer to my particular need. There are actually two related situations I need to find solutions for. 1. On a data entry form, for certain fields I want to do some validation right after the user leaves the field (rather than wait until the entire form is completed). If invalid, I want a modal window to pop up with my composed message in it and an OK button. When the user presses OK, control returns to the data entry form remaining in the problem field. 2. On a data entry form where an existing record is being updated, if the user changes a non-empty field to different value in any field (with a few exceptions), I want a modal window to pop up with a confirmation message and OK and Cancel buttons. When the user presses OK, control continues normally to the next field on the form. When Cancel, the user''s change will be reversed (restoring the previous value to the field) and control remains in the problem field. Is there one simple way to do each of these two things (hopefully DRY for the second one)? Thanks, Shauna --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, I''ve searched and can''t find a straightforward answer to my particular need. There are actually two related situations I need to find solutions for. 1. On a data entry form, for certain fields I want to do some validation right after the user leaves the field (rather than wait until the entire form is completed). If invalid, I want a modal window to pop up with my composed message in it and an OK button. When the user presses OK, control returns to the data entry form remaining in the problem field. 2. On a data entry form where an existing record is being updated, if the user changes a non-empty field to different value in any field (with a few exceptions), I want a modal window to pop up with a confirmation message and OK and Cancel buttons. When the user presses OK, control continues normally to the next field on the form. When Cancel, the user''s change will be reversed (restoring the previous value to the field) and control remains in the problem field. Is there one simple way to do each of these two things (hopefully DRY for the second one)? Thanks, Shauna -- 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-/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 -~----------~----~----~----~------~----~------~--~---
You''re going to need to use javascript to do this, not rails. shauna wrote:> Hi, I''m relatively new to Ruby on Rails. I''ve searched and can''t find a > straightforward answer to my particular need. There are actually two > related situations I need to find solutions for. > > 1. On a data entry form, for certain fields I want to do some > validation right after the user leaves the field (rather than wait > until the entire form is completed). If invalid, I want a modal window > to pop up with my composed message in it and an OK button. When the > user presses OK, control returns to the data entry form remaining in > the problem field. > > 2. On a data entry form where an existing record is being updated, if > the user changes a non-empty field to different value in any field > (with a few exceptions), I want a modal window to pop up with a > confirmation message and OK and Cancel buttons. When the user presses > OK, control continues normally to the next field on the form. When > Cancel, the user''s change will be reversed (restoring the previous > value to the field) and control remains in the problem field. > > Is there one simple way to do each of these two things (hopefully DRY > for the second one)? > > Thanks, > Shauna > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Shauna wrote:> > Hi, I''ve searched and can''t find a straightforward answer to my > particular need. There are actually two related situations I need to > find solutions for. > > 1. On a data entry form, for certain fields I want to do some validation > right after the user leaves the field (rather than wait until the entire > form is completed). If invalid, I want a modal window to pop up with my > composed message in it and an OK button. When the user presses OK, > control returns to the data entry form remaining in the problem field. > > 2. On a data entry form where an existing record is being updated, if > the user changes a non-empty field to different value in any field (with > a few exceptions), I want a modal window to pop up with a confirmation > message and OK and Cancel buttons. When the user presses OK, control > continues normally to the next field on the form. When Cancel, the > user''s change will be reversed (restoring the previous value to the > field) and control remains in the problem field. > > Is there one simple way to do each of these two things (hopefully DRY > for the second one)? >Sounds like you''d want a GUI (desktop) app instead ;-)... Ditto on what Jason said on JavaScript. Long www.edgesoft.ca/blog/read/2 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bingo! I''m trying to create a web-based version of a desktop app for proof-of-concept. So there are a few key things that I need to check out to see if this is feasible within a reasonable timeframe. Rails simplifies a great many aspects that would otherwise require complex combinations of available methods. Can it help with this one? Thanks for all the help I''ve received from this forum - both from searching it for past solutions and for answering my questions! Shauna -- 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-/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 -~----------~----~----~----~------~----~------~--~---
If it''s input format validation, that can be done in pure JavaScript with no repercussions. Just link up a field with the onBlur() event (I think, and that might not be fully cross-browser) for validation. Otherwise, for real-time password type data validation, you''ll need to use the observe_field() helper and return some RJS code to pop up the dialog and then select the field. Help on these specific topics are on this list, in the Rails docs: api.rubyonrails.com, and (I think) in the newest of Agile Programming with Rails. Jason On 12/7/06, Shauna <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Bingo! > > I''m trying to create a web-based version of a desktop app for > proof-of-concept. So there are a few key things that I need to check out > to see if this is feasible within a reasonable timeframe. Rails > simplifies a great many aspects that would otherwise require complex > combinations of available methods. Can it help with this one? > > Thanks for all the help I''ve received from this forum - both from > searching it for past solutions and for answering my questions! > > Shauna > > -- > 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-/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 -~----------~----~----~----~------~----~------~--~---
Thanks, Jason. That gives me some paths to follow in the thicket of possibilities! Shauna -- 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-/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 -~----------~----~----~----~------~----~------~--~---
On Thursday 07 December 2006 20:27, Shauna wrote:> Hi, I''ve searched and can''t find a straightforward answer to my > particular need. There are actually two related situations I need to > find solutions for. > > 1. On a data entry form, for certain fields I want to do some > validation right after the user leaves the field (rather than wait > until the entire form is completed). If invalid, I want a modal > window to pop up with my composed message in it and an OK button. > When the user presses OK, control returns to the data entry form > remaining in the problem field.I''d be very annoyed if I were lambasted by a modal dialog each time each time I haven''t filled-in a field correctly. Of course, I want to be notified that there''s something wrong with the field, but I''d much prefer a more unobtrusive way. That said, have a look at the recent thread with subject "Java script validations".> 2. On a data entry form where an existing record is being updated, if > the user changes a non-empty field to different value in any field > (with a few exceptions), I want a modal window to pop up with a > confirmation message and OK and Cancel buttons. When the user presses > OK, control continues normally to the next field on the form. When > Cancel, the user''s change will be reversed (restoring the previous > value to the field) and control remains in the problem field.Here, too, I''d recommend a less obtrusive approach. Mark changed fields in some way or show the old values next to the current ones. Once upon a time, I''ve written a small script that does the marking. http://www.schuerig.de/michael/javascript/change_marker.js Please don''t take this script as is, only as a source for ideas. Also, have a look at the validator script in the plugin I refer to in the thread mentioned above. Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Shauna wrote:> Hi, I''ve searched and can''t find a straightforward answer to my > particular need. There are actually two related situations I need to > find solutions for. > > 1. On a data entry form, for certain fields I want to do some validation > right after the user leaves the field (rather than wait until the entire > form is completed). If invalid, I want a modal window to pop up with my > composed message in it and an OK button. When the user presses OK, > control returns to the data entry form remaining in the problem field. > > 2. On a data entry form where an existing record is being updated, if > the user changes a non-empty field to different value in any field (with > a few exceptions), I want a modal window to pop up with a confirmation > message and OK and Cancel buttons. When the user presses OK, control > continues normally to the next field on the form. When Cancel, the > user''s change will be reversed (restoring the previous value to the > field) and control remains in the problem field. > > Is there one simple way to do each of these two things (hopefully DRY > for the second one)? > > Thanks, > Shauna > > -- > Posted via http://www.ruby-forum.com/I have actually been working on a system that creates a ''live-form'' that uses AJAX to do real time validations and some other funky stuff. It''s still pretty rough around the edges, and real work keeps preventing me from extracting it for the moment, but it is possible. The gist of the way it works is to create a form_observer that calls a form validation method. This method returns an RJS template that updates the page to indicate errors and provide some other useful feedback. This approach has a bunch of pitfalls, but when it works well, it''s wonderful. Hopefully I''ll be able to write this up in more detail soon, so watch this blog for details... www.sciwerks.com/blog --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---