This script allows you to change the order of day/month/year to show to respondents in a Date question. Without a script, the survey page shows the Date question in the following format (MM/DD/YYYY) by default.
Example
You may want to ask the Date question in the following format instead, as would be the case in most non-US markets:
Detailed Steps
- Create a Date question as required.
- Copy one of the two scripts below (based on your requirement) into Notepad or any other text editor (e.g. Notepad++, Textpad).
- Change Q_DATE to the name of your Date question.
- Insert the completed script into the Script section of the date question by doing the following:
- Select the Date question in the Questionnaire Tree.
- In the Scripting section of the page, click Edit Scripts.
- Paste the script into the On Load tab.
- Click Save.
- Click Validate and test your survey.
Script
/*Script Name: How do I change the order of day/month/year in a Date question? (Power Surveys)
To ensure your script works as expected, always copy the original script from the script library found in the support portal. Failure to use the most up to date script from the script library may cause unexpected results.
*/
Example Layout | Script |
---|---|
Day - Month - Year |
VerbatimQuestion vq = Q_DATE;
if(Between(3,4,(int)RespondentExperience)){
vq.Html += "<style>#DaySelector_"+vq.Name+"{float:left;}#MonthSelector_"+vq.Name+"{margin: 0 2px;}</style>";
} else {
vq.Html += "<style>#i"+vq.Id+"VerbatimQuestion_Day{float:left;}</style>";
}
|
Year - Month - Day |
VerbatimQuestion vq = Q_DATE;
if(Between(3,4,(int)RespondentExperience)){
vq.Html += "<style>#YearSelector_"+vq.Name+"{float:left;}#DaySelector_"+vq.Name+"{margin: 0 2px;}</style>";
} else {
vq.Html += "<style>#i"+vq.Id+"VerbatimQuestion_Year{float:left;}</style>";
}
|
More Information
Read this WebHelp article to learn more about Date question.
Comments
0 comments
Article is closed for comments.