After Setting up the Questions and Answers, it is now time to create a contact form to gather user contact details or any other specific details that you need, you can use this form to ask for details before or after answering the Quiz/Survey.
Contact form helps us gather user information that we can later use for various things for like sending Quiz alerts, sending users their results, sending newsletters, and much more.
You can collect contact information like Name, Email, Business, Phone Number, etc by creating a Contact form in the Contact Tab. You can create multiple input fields as a form in the contact tab.
To create a form and add contact fields to your Quiz/Survey, Click Add New Field Button.
Contact Field Type
When you add a new field, you will see a new box with various field types. There are 6 Contact Field Types in QSM
- Text – This is a text box for information such as name, business, phone, etc.
- Email – This is a text box that checks to ensure the entered information is an email address
- URL – This field type can be used to accept URLs as input from the user.
- Number – This field type can be used to accept number input from the user, its possible uses are for accepting phone numbers, Student id, P.O. Box numbers, etc.
- Date – This adds a date field to input the date from the user. You can specify the data format from the Options Tab.
- Checkbox – This is a checkbox that can be used for making sure a user agrees to terms and conditions
One thing to note here is that 4 contact fields come pre-built and are disabled by default. They are Name, Email, Business & Phone. You are allowed to change their label as per your need however you won’t be able to change their type. These 4 fields are permanent and can’t be deleted.
After selecting the type, you would need to fill in the “Label”. This will be the text that appears next to the field.
Inside the form settings, you will find a variety of settings based on the form type you are currently editing.
If selected, The “Required?” option is a checkbox that will force the user to fill in the field prior to submitting the quiz or survey.
Specify the minimum length of the input text or number
Specify the maximum length of the input text or number
Input the list of the email domain extensions that you want the user to input. You need to enter a comma-separated list of domain names. If kept blank, all domain name extensions will be allowed to input.
To duplicate a field, click the “Duplicate” icon.
To delete a field, click the “Delete” icon.
Enable or Disable a field to make a contact field active or inactive for a quiz or survey.
Show Disabled Fields
Unhides and shows all the disabled fields that are hidden
Select from a list of available form options for a quick form setup.
Add New Field
Clicking on the “Add New Field” button adds a blank contact field that can be customized as per your needs.
After you have added all of the fields you wanted, be sure to click the “Save Form” button that can be found below the Form Options box.
Advanced Option: Checking the Entered Email
Note: Following changes only needs to be performed if you really know what are you are exactly doing if you don’t understand it’s better to get it done by an expert.
If you want to check/verify the user entered email in the contact form and just want to allow emails from specific servers then you can call a hook
qsm_send_results_email_addresses in the class-qsm-emails.php file.