Custom validation scripting code can be inserted to the Validation script box to prevent users from continuing, deciding what page to jump to, and for advanced question validation. The Validation script box is located on the right side of the screen when you select a Section title object. Press the JS/Perl button to toggle between Javascript style and Perl style syntax. You can also view the Validation script box from the Validation tab of the advanced question options for Section title objects.
Custom JavaScript validation code is used in combination with the compiled CGIs. Custom Perl validation code is used in combination with the Perl CGIs.
All of the custom validation scripting code should be put into the projectname.val file.
if(condition)
{ [statements] } else (line break needed- nothing on this line after the else is evaluated) { (line break needed) [statements] (line break needed) } (space usually necessary) |
runReport
Process a .rep file and return the HTML code that it outputs.sendMail
Send an email message to the specified recipient. Note: the EMAILSERVER parameter must be in the .ini file for sendMail to know what email sever to use.ShowPage
Decide what page is shown next. The page name is going to be "page" then the name of the Section title that starts that page. For example, if the page I wanted to go to is named "Q2", I would put in "pageq2". The last page of a multiple page survey does not check for the ShowPage; it will automatically submit.
_msgtext = runReport('project.rep','project2.rep');
sendMail('raosoft@raosoft.com','EZSurvey submissions',_msgtext); |
if(Q35 =='2')
{ if(/Q36/ ne '') { _PAGEWARN += 'notpossible,'; } } |