This demonstration illustrates the use of regular expressions and question events. Below is a breakdown of each field and how it is set up.
1) First Name - regular text box, required field.
2) Last Name - regular text box, required field.
3) Email - required field. We used a regular expression that forces the user to enter an email that is standard format. Regular expression used: ^[_a-zA-Z0-9-] (\.[_a-zA-Z0-9-] )*@[a-zA-Z0-9-] (\.[a-zA-Z0-9-] )*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$
4) Phone Number - we use a regular expression for the phone number that forces the number to be entered in the following way: ###-###-####. If the user enters letters or does not enter dashes between area code and suffix, they will be asked to enter in a valid entry. This is not a required field, as those users who live outside of the United States are asked to skip this question. We also used a Text Header on the phone number text box that instructs the user what the valid format is. Regular expression used: \(?\d{3}[-.]\)? ?\d{3}[-.]\d{4}
5) The country field is populated by SQL Driven Options. Here's what we used for this demo:
Select '– Select Country –' as QuestionOption, ' – Select Country –' as QuestionOptionValue
Union
select Text as QuestionOption, Text as QuestionOptionValue from Lists where ListName= 'country' order by QuestionOption
select Text as QuestionOption, Text as QuestionOptionValue from Lists where ListName= 'country' order by text
- If user chooses United States, next option is to choose a US state. Drop down combo box for US state is done through SQL Driven Options using this:
Select '– Select State –' as QuestionOption, ' – Select State –' as QuestionOptionValue
Union
select Text as QuestionOption, Text as QuestionOptionValue from Lists where ListName= 'Region' and parentid=221
- Similar statements have been used to pull Provinces if user chooses Canada.
See other Form Demos.