Dynamically switch the page translation
If you wish to automatically change the language selection for the survey using javascript you can simply use:
jQuery("select[id='Q_lang']").val([language code here]); // change [language code here] to "ES" or whatever translation code you wish to switch to
jQuery("select[id='Q_lang']").trigger( "change" );
Below is a use case for changing the page translation based on the selected response to a question:
var qid=this.questionId; // current question ID
var objResponseOpt = jQuery("select[id='QR\\~"+qid+"']"); // current selection list object
// listen for changes to the selection list
objResponseOpt.on('change',objResponseOpt,function (e) {
responseChange(e);
});
function responseChange(e) {
if (typeof e.isTrigger == 'undefined') {
// change the language selector depending on selected list option
if (e.currentTarget.options.selectedIndex==1 || e.currentTarget.options.selectedIndex==4) {
jQuery("select[id='Q_lang']").val("ES");
jQuery("select[id='Q_lang']").trigger( "change" );
}
else {
jQuery("select[id='Q_lang']").val("EN");
jQuery("select[id='Q_lang']").trigger( "change" );
}
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
