Difference between revisions of "Close to URL"

From Catglobe Wiki
Jump to: navigation, search
(Example)
Line 1: Line 1:
== Challenge ==
+
== Close URL ==
You want the respondent to be automatically redirected to a URL when he clicks on the Close button
 
== Example ==
 
When user finished the questionnaire , you want them to redirect to Catglobe homepage
 
  
== Code ==
+
In order to show a specific site when he clicks on the Close button
<source lang="javascript" line="1">
+
 
 +
As a questionnaire creator
 +
 
 +
I want the respondent to be automatically redirected to a URL when he clicks on the Close button
 +
 
 +
'''Example'''
 +
 
 +
When user finished the questionnaire , you want them to redirect to Catglobe homepage
 +
 
 +
=== Solution  ===
 +
 
 +
*Add a Page question to Questionnaire editor like below
 +
*Go to menu Properties -&gt; Question properties -&gt; Common tab -&gt; Check End
 +
 
 +
 
 +
 
 +
[[Image:CloseURL_Properties.png]]
 +
 
 +
*Go to menu Properties -&gt; Question scripts -&gt; Java script tab -&gt; Input below script
 +
 
 +
 
 +
 
 +
[[Image:CloseURL_Code.png]]
 +
 
 +
=== Code ===
 +
 
 +
<source lang="javascript">
 
function closeToURL()
 
function closeToURL()
 
{
 
{
Line 11: Line 34:
 
}
 
}
 
quest.close = closeToURL;
 
quest.close = closeToURL;
</source>
+
</source>  
 +
 
 +
=== Source  ===
 +
 
 +
Questionnaire Resource Id on cg site: 159730

Revision as of 06:11, 11 January 2012

Close URL

In order to show a specific site when he clicks on the Close button

As a questionnaire creator

I want the respondent to be automatically redirected to a URL when he clicks on the Close button

Example

When user finished the questionnaire , you want them to redirect to Catglobe homepage

Solution

  • Add a Page question to Questionnaire editor like below
  • Go to menu Properties -> Question properties -> Common tab -> Check End


CloseURL Properties.png

  • Go to menu Properties -> Question scripts -> Java script tab -> Input below script


CloseURL Code.png

Code

function closeToURL()
{
	document.location = "http://www.catglobe.com";
}
quest.close = closeToURL;

Source

Questionnaire Resource Id on cg site: 159730