How to set a web form control to be dynamically required

Using the WorkflowGen FORM_FIELDS_REQUIRED action parameter sets the control to always be required. To dynamically require a control, it must be managed in code-behind, and not with the WorkflowGen FORM_FIELDS_REQUIRED action parameter.

To do this, insert a .NET required field validator and set its ControlToValidate property to the control that you want to require. In the validation control’s properties window, set the ValidationGroup to WFGENPage and Display to none. This is to group the validation control to the WorkflowGen validation group. When a user clicks the Submit button, the newly-added validation control’s error message will be combined with WorkflowGen’s required fields error message.

The .cs file is where you add a conditional statement to set the validation control’s Enable property to true or false based on the dependent control’s state. For example:

if (CheckBox1.Checked){
    RequiredFieldValidator1.Enabled = false;
}

If you have a Save as Draft button in your form, you have to make sure that the validation control is not enabled; otherwise, .NET will stop the form submission since the form will still be missing a required field. To do this, set the validation control’s Enable property to false before calling the SubmitToWorkflow() method. For example:

protected void btnDraft_Click(object sender, EventArgs e){
    RequiredFieldValidator1.Enabled = false;
    DRAFT.Text = "YES";
    SubmitToWorkflow();
}

Where is the validation control’s properties window?