its ok if you use a toolbar, but if you dont and use a form-based button to save changes then you still have the problem.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Gene Wirchenko Sent: Wednesday, 7 October 2009 11:45 AM To: ProFox Email List Subject: Re: VFP9 - Valid At 16:54 2009-10-06, Sytze de Boer <[email protected]> wrote: >I have a form with a bunch of text boxes >It has 2 command buttons, OK and CANCEL > >One of the TEXT boxes has a valid condition that says "Sorry, Reference may >not be left blank" >My client says, Hang on, I just clicked the Cancel button, I don't want to >enter a Reference >But I can't find a way to do this. I solved this problem over ten years ago in VFP 5. (There might be a better way now, but . . .) My cancelling button is on a toolbar. Clicking on a toolbar does not cause focus to attempt to shift. (It is this that causes the .valid() to fire.) In the cancelling button's .click(), I set a form-level property called .vbypass. My validation routines check this value at their starts. If it is true, they simply return as if no error. If it is false (the usual case), the validation is performed. >(Should I remove the valid clause and make it part of the OK command?) That is debatable. Some people like field-level validation. Some prefer that all validation be done when the form is complete. I lean to the former view myself, but Y (and your app's users') MMV. Sincerely, Gene Wirchenko [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

