Disallow blank input
in required fields

Chong-ho (Alex) Yu, Ph.D., MCSE, CNE

Problem:

How can I set up multiple Web forms to disallow blank input in required fields? This seems to be easy. How about check "Not Empty" as "Validation" in the FileMaker Pro database? No, it does not work! If the survey spans across several Webpages, the user cannot submit answers to the server even in the first page! When answers in Page 1 are submitted, other fields not shown in Page 1 are also validated by FileMaker Pro. If they are blank, the submission will fail. You could use JavaScript to do a client-side validation. In this write-up I will introduce a server-side approach.

Solution:

For the ease of illustration, I assume that you distribute the questions into two Webpages only (Question 1 through 9 are in Page 1. Question 10 through 19 are in Page 2). For questions in Page 1, you can use "Not Empty" as "Validation." For questions in Page 2, create a calculation field named "flag2" in FileMaker Pro. Enter the following if-then-else function in the calculation field:

	If(IsEmpty(Q10) or
		IsEmpty(Q11) or
		IsEmpty(Q12) or
		IsEmpty(Q13) or
		IsEmpty(Q14) or
		IsEmpty(Q15) or
		IsEmpty(Q16) or
		IsEmpty(Q17) or
		IsEmpty(Q18) or
		IsEmpty(Q19),
 	0, 1 )

Next, create a text field named "page2." In Validation select Validated by calculation and specify the calculation as "flag2=1." In Page 2 insert the following code. If any field of Question 10 through 19 is blank, the value of "flag2" will be "0," Since "page2" accepts input if and only if "flag2=1," an error message will prompt the user to re-enter the required data.


	<INPUT TYPE=hidden NAME=page2 VALUE=1>

This method can be applied to multiple pages, too.


Navigation

FMP Tips Contents

Other computer tips

Search Engine

Credit/Copyright ©

Simplified Navigation

Table of Contents

Contact Me