Hello:
First, if you don't already know this, do not check the "Cannot be Blank" button in the Properties dialog. Instead, manually set validation rules and conditions that determine whether a control/field can or cannot be blank.
Second, even if a control is not visible (hidden), it still is "present" on the form unless you programmatically delete it. So you can't set "is not present" as the condition for skipping validation. The control is still there, just invisible.
I use several methods to bypass the validation step for a hidden field. See if one of these works for you:
-
Use option buttons to determine whether or not a field/group/section is visible. With your control that cannot be blank:
-
Set a rule that will only validate the control if the user selects Option A
-
If Option B is selected, the control is made invisible and validation is never called
-
With many forms, I can't use Roles and Views because the forms are sent outside our server domain. So, in order to get the same effect -- determine field visibility, disable or enable buttons, set controls to read-only, or trigger validation only under certain conditions -- I include an invisible section with various fields whose values are set according to different states in the workflow or values the user has selected on the form.
For example on one form I include an invisible "Status" textbox. Then I set the Status field's value according to the stage in the workflow.
-
If the form has not yet been submitted, Status = "New"
-
If the form has been sent, Status = "Sent", exposing new functions and disabling others
-
If the job has been completed, Status = "Completed" and the "Completed" view and messages are sent back to the initiator/
In scenario 2 above, a whole host of validation rules, field display conditions, and alternate functions are set depending upon the value of "Status." With that trick, you can get the same functionality as roles and views. That "invisible field" trick also works well for setting conditions for validation.
Hope some of this helped.
Noel C. Gordon