Validating submission to avoid schedule conflicts
Chong-ho (Alex) Yu, Ph.D., MCSE, CNE
I created a webpage for users to register for a conference. In the form the users can select different seminars in the conference as the following:
Several seminars will be held at the same time. The server should reject the input if the selection leads to a schedule conflict.
I have experimented with several ways for this type of erroring checking. Before I tell you what can work, let me tell you what cannot work. Using
IsEmptyfunction may not work properly. For example, you can set up a validation rule for the field Seminar 1 as
"IsEmpty(Seminar 2) and IsEmpty(Seminar 3)"It works fine as long as the user does not go back to edit his record. If the user wants to cancel Seminar 2 and choose Seminar 1, he will not be allowed to do so because even if Seminar 2 is deselected, the field value is "blank" rather than "empty." ("Blank" is datum of nothing but "empty" is no datum at all) Also, in a web form even if the field is empty, it will be submitted as "blank."
The following is a better way:
- Create fields "Seminar 1-Seminar 9" as numeric fields.
- In Auto Enter make "0" as the default value.
- Create three text fields. Name them as "Check morning," "Check afternoon" and "Check evening."
- In "Check morning, enter this validation rule:
"Seminar 1 + Seminar 2 + Seminar 3 < 2". It means that the user can choose either none or one of those seminars. Apply the same rule into "Check afternoon" and "Check evening."
- In both new.htm and record_detail.htm, add the following tags. It will force the submission to activiate the validation.
The same approach can be applied to more complicated scheduling.
FMP Tips Contents