General information
Category:
Forms & Form designer
I have a form with controls. During the saving of the record the program validates the data. Each control has a property - .lRequired that is .t. if the control is required to be filled in with data - a name for example. I would like for loControl to be in the tabindex order of the screen. I am trying to write a more universal routine than the one we have now that checks a control at a time. We seem to forget to include validation when we turn on one control at a time. Duh, huh? The problem is that the one we have now checks the controls one at a time in the order they occur in the .rec_valid method and we can place them there in any order we want. The one I am writing now checks the controls in the order of loControl array. I'm looking for a way to easily order the loControl array to match the order of the tabindex for the screen. Comments?
The example of the loop in its current state is -
LOCAL loControl, lcReQMsg, llNoPass, lcSetFocus
FOR EACH loControl IN This.Controls
* The following will work for character and date and time.
IF TYPE("loControl.txtTextBox") <> "U" AND ;
EMPTY (loControl.txtTextBox.Value)
llNoPass = .T.
lcSetFocus = "loControl.txtTextBox.Setfocus()"
ENDIF
IF TYPE("loControl.edtEditBox") <> "U" AND ;
EMPTY(loControl.edtEditBox.Value)
llNoPass = .T.
lcSetFocus = "loControl.edtEditBox.Setfocus()"
ENDIF
IF llNoPass
IF TYPE("loControl.cReqMsg") = "C" AND ;
!EMPTY(ALLTRIM(loControl.cReqMsg))
lcReQMsg = ALLTRIM(loControl.cReqMsg) + " is a required field. " + ;
"Please re-enter."
ELSE
lcReQMsg = "You have failed to enter a required field. " + ;
"Please re-enter."
ENDIF
=MESSAGEBOX( lcReqMsg, MB_OK + MB_ICONEXCLAMATION, goApp.cSysTitle )
&lcSetFocus
RETURN .F.
ENDIF
ENDIF
NEXT loControl
Thanks in Advance
sjwilson
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only