Conditional Submit Button

J

Jeffro

Scenario:

Have a form that a user will fill out to request access to various IT
applications. After filling out personal information name, office,
telephone # etc. there are a series of check boxes that the user can
check to request access to various applications.
On my form, I do have a submit button at the bottom of the form. When
the user clicks on the Submit button, I have rules set up that checks
which checkboxes(s) have been checked and emails are sent to the
appropriate individuals depending on which boxes are checked.

What I'm trying to figure out is how to handle either of the following:

1. The Submit button is not enabled unless one of the Check boxes is
checked or

2. When the user clicks on the Submit button, if none of the check
boxes have been checked, a message is displayed alerting the user to
check one of the boxes and the Submit process is cancelled and the
focus is returned to the form so the user can check one or more of the
checkboxes.
 
B

Ben Walters

Jeffro,
There are a couple of ways around this problem
1: Use the conditional formatting rules on the Button control to disable it
unless one of the check boxes have been ticked.

2:Using managed code you can fire the Submit event from the event handler of
your button control. The code would roughly look like this

bool CheckBoxState = false;
foreach(Checkbox on your form)
{
if(checkbox ticked)
{
CheckBoxState= true;
}
}
If (CheckBoxState )
{
e.XDocument.Submit();
}
else
{
e.XDocument.UI.Alert("Please Select a checkbox");
}
 
Top