Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: tushar Kanvinde
  Where is tushar Kanvinde?
 Kolhapur, Maharastra
 India
 tushar Kanvinde
 To: mk sharma
  Where is mk sharma?
 mumbai
 India
 mk sharma
 Tags
Subject: RE: how to bypass the vaid method
Thread ID: 249085 Message ID: 249112 # Views: 1 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Monday, December 28, 2009 4:59:53 PM         
   


> please post a example/sample
>
> warm regards,
> mk.
>
> >
> > As Stefan says, a form level validation is better. You can have a control level validation which does not stop the focus from going to the next control, but only gives an indication that there is a problem by changing the backcolor to red. In the form level validation that is called on clicking the OK button, all the valid methods of all the controls in the form are called.
> >
> > Regards
> > Tushar

Add a property to you form class called AllControlsOK.

In your textbox class (and all other input classes) , add a method called checkvalue. Put the code to check validity here. Also change the color of the control depending on its validity. In case it is not valid, change the value of thisform.AllControlsOk to .F.

In the valid event, call the checkvalue method. But in the valid event, return .T. irrespective of if it is valid or not.

Then add a property to the class called checkit. In the assign event of this method, call the CheckValue method.

In the OK button, give

thisform.AllControlsOK=.T.
thisform.setall('CheckValue',.T.)   && this will make all the invalid controls to red and make AllControlsOK to .F. in case of problems.
if thisform.AllControlsOK
   Save the Data
endif


I also have a property to enter the error message and make it the tool tip in case of error in the CheckValue method. Otherwise if the value is ok, you have to set it back to default.

I don't have my classes currently here, so there may be something I have missed.

Regards
Tushar

ENTIRE THREAD

how to bypass the vaid method Posted by mk sharma @ 12/28/2009 10:33:59 AM
RE: how to bypass the vaid method Posted by M. Akram Bhatti @ 12/28/2009 10:43:18 AM
RE: how to bypass the vaid method Posted by mk sharma @ 12/28/2009 10:57:40 AM
RE: how to bypass the vaid method Posted by Rahul Moudgill @ 12/28/2009 11:49:55 AM
RE: how to bypass the vaid method Posted by mk sharma @ 12/28/2009 11:29:47 AM
RE: how to bypass the vaid method Posted by Stefan Wuebbe @ 12/28/2009 11:44:52 AM
RE: how to bypass the vaid method Posted by tushar @ 12/28/2009 12:35:00 PM
RE: how to bypass the vaid method Posted by mk sharma @ 12/28/2009 1:26:31 PM
RE: how to bypass the vaid method Posted by ho me @ 12/28/2009 2:48:03 PM
RE: how to bypass the vaid method Posted by tushar @ 12/28/2009 4:59:53 PM
RE: how to bypass the vaid method Posted by tushar @ 12/29/2009 8:28:30 AM