Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Modal data child required field
Message
From
17/09/2002 15:03:48
 
 
To
17/09/2002 13:55:23
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00701385
Message ID:
00701446
Views:
13
Hi John:

>I am calling a frmmodaldatachild. On the form there are two combo's and lrequired = .t.for both. But the form will still allow me to leave each of the combo boxes blank. Does anyone have any ideas?

This is a problem that I have referred to Dave in the past but he doesn't see it as a problem. In his view, if data has not been changed, it shouldn't be validated. If it doesn't get validated, the code that checks for the required field(s) is not processed. Therefore, if you load a modal data child and dont change anything but the controls are "required", this process is bypassed. There are numerous solutions to this problem that all involve subclassing. However, you could try something like the following that involves subclassing the form's Save method :-
Function frmModalDataChild.Save
LParameters cWorkAreaList
*-- Make sure we enforce any "lRequired" values
If Not Thisform.lChanged
   If Not This.ValidateForm(m.cWorkareaList)
      Return .F.
   Endif
Endif
Return Dodefault(m.cWorkAreaList)
Personally, I think there should be a framework originated form property that can be set True so that even when there are no data changes, the framework checks to enforce "required" field.

HTH

Best
-=Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform