Day 12: Messages and HTML
Previous Topic  Next Topic 

In the last lesson we asked you to understand the use of the FORMATTED question. If you have not done that, go back and do it now before continuing with this lesson.


This lesson will show you how to make full use of the MESSAGE question and basic HTML functions you can use to improve presentation.


Note

You can use the MESSAGE question to display VARIABLES from anywhere in the survey.


Now do the following.


    1. Open the survey you created on Day 4 of this tutorial 'Day 4'. Then create a copy of the survey under a different name. Name the survey 'Day 9'.


    1. This survey consists of a DIRECTED, a RANDOM and a FORM section. MESSAGE questions function more accurately within DIRECTED sections, as the MESSAGE will pop up after a question is answered. They are not recommended for use in FORMS.

Change the RANDOM and FORM sections in your survey so that they become DIRECTED sections. To do this enter the MAIN SECTION of your survey, click each section once with your mouse so that the section is highlighted. You can either select the DIRECTED box found on the PocketSurvey Designer Toolbar and click APPLY, or click DIRECTED in the QUESTION DEFINITION DIALOG and MODIFY your change. Your survey should now consist of 3 DIRECTED sections.


    1. Within each DIRECTED section are 3 questions. The 3rd question in each section of the survey should be a number question. Enter SECTION 1 and delete the 3rd question entitled “Number 1” by clicking on the question in the PocketSurvey Designer and pressing the delete key on your keyboard. Repeat this in SECTION 2 and SECTION 3 so that each SECTION contains only the 2 questions, “Menu” and “Ticklist”. Save your survey.


    1. In the MAIN SECTION change the QUESTION PROMPT so it reads “Name”. Click the DATA NAME box above the QUESTION BOX and enter “Name”. The DATA NAME function allows a question to have a more concise, shortened name typically used in summoning variables from different areas of a survey. If the QUESTION PROMPT has a long character length these calculations can become long and tedious to write out so a DATA NAME helps organise your calculations more efficiently. If a DATA NAME is present in a question, this will be recognised as the primary question name you should refer to in all calculations. The DATA NAME will also be the menu headings used once the data is retrieved from the survey.


    1. In SECTION 1 create a DATA NAME for MENU 1 entitled “M1”. Create a DATA NAME for TICKLIST 1 entitled “T1”. Repeat this for SECTION 2 and SECTION 3 so that all 6 questions contained shortened 2 letter DATA NAMES. 


    1. The next step is to create a MESSAGE question at the end of each section so that when each section in the survey is completed, a MESSAGE will pop up informing you of your progress. Click the diamond in SECTION 1 and click the MESSAGE tab in the QUESTION DEFINITION DIALOG. Enter a QUESTION Prompt of “Message 1” and set the DATA DESTINATION FILE. In the TEXT TO DISPLAY box enter the following text:


{{Name}} prefers {{M1}}{{T1}}


    1. As previously explored in lesson 5, putting double curly braces around a question name will result in the chosen answer to that question being displayed in MESSAGE 1. So in this instance, if you enter “Joe Bloggs” when prompted with the NAME question in your survey, the MESSAGE will display:


Joe Bloggs prefers…


    1. Run your survey to view MESSAGE 1. It should appear as a pop up box displaying the name you entered and the choices you made in MENU 1 and TICKLIST 1.


    1. In SECTION 2 create a new MESSAGE question entitled “Message 2” setting its DATA DESTINATION FILE to NONE. In the TEXT TO DISPLAY box enter the following text:


{{Name}} prefers


    1. The MESSAGE needs to display the answers from SECTION 1 and SECTION 2 however if a variable that is in a different SECTION is being summoned a different EXPRESSION should be used. Click in the TEXT TO DISPLAY box so the cursor is situated at the end of the current EXPRESSION. In the drop down SECTION menu below select SECTION 1. Now in the VARIABLES menu below select M1 and then T1. Your TEXT TO DISPLAY box should now read:


{{Name}} prefers {{SECTION 1.M1}}{{SECTION 1.T1}}


    1. To display your answers from SECTION 2 add {{M2}} and {{T2}} to the end of your EXPRESSION accordingly. You may have noticed the STYLE and PLACEMENT options in the MESSAGE QUESTION DEFINITION DIALOG. If any of these are changed from the default setting of PLACEMENT LEFT; the MESSAGE will be displayed in HTML format. Select ITALICS from the STYLE list. RUN your survey and MESSAGE 2 should display your NAME, and the answers selected in SECTION 1 and SECTION 2.


    1. Create a final MESSAGE at the diamond in SECTION 3 entitled “Message 3”. This message will display all the answers you have chosen in the survey, and display them in a more organised format. Select ITALICS and INVERT from the STYLE list.


    1. Now that MESSAGE 3 will be displayed in HTML, simple HTML commands can be added in the TEXT TO DISPLAY box to aid in the structure of the MESSAGE. First follow the principles learnt so far in this lesson to create the following EXPRESSION:


{{Name}} prefers: {{SECTION 1.M1}}{{SECTION 1.T1}}{{SECTION 2.M2}}{{SECTION 2.T2}}{{M3}}{{T3}}


    1. If you RUN the survey MESSAGE 3 will display all the answers chosen for all 3 Sections.


If you are comfortable using HTML you should try integrating the following commands to structure your MESSAGE more professionally:


<b> </b> = Text entered within these parameters will be seen in BOLD.

<br> = Line break

<p> = Paragraph break


Try entering the following EXPRESSION in the TEXT TO DISPLAY box:


<b>{{Name}}</b> prefers:<br><p>{{SECTION 1.M1}}{{SECTION 1.T1}}<br>{{SECTION 2.M2}}{{SECTION 2.T2}}<br>{{M3}}{{T3}}


The next lesson will show you how to use NESTED MENUS within the MENU question.


Final Tip

If any of the STYLE or PLACEMENT choices are changed from the default set up your message will be displayed as HTML. If you want your message to be displayed in a pop up box you must not edit any of these variables and restrict yourself to entering a message in the TEXT TO DISPLAY box. Also if the SHOW box is ticked all the messages you created in a survey will be displayed together. This feature is useful if you have used loops in your survey or it is particularly long.

HandHeld Systems Ltd ©