Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Executing hidden question

Executing hidden question 1 Jahr 7 Monate her #94533

  • kubaj
  • kubajs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
Hi I have a "fake" array question which includes javascript code which automatically prefill the array with the answers filled in different variable length array questions before to get some structure to have ready variables for conditioning successive questions. The script works great I get the values. When I hide this question the javascript code is not executed. Do you have any idea how to execute the code for filling the answers but not to display this question (or whole one group of questions)?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Executing hidden question 1 Jahr 7 Monate her #94566

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4371
  • Dank erhalten: 829
  • Karma: 381
If you want to manipulate a question with JavaScript you can't use the " Always hide this question" advanced setting.

You will need to hide it with JavaScript:
$('#questionQQ').hide();

Or with CSS:
#questionQQ {display: none}

(where "QQ" is the question ID)
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Executing hidden question 1 Jahr 7 Monate her #94587

  • kubaj
  • kubajs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
Hi, thanks - it didn't worked for me, because instead of QQ (just 1234 for example) I have put whole QID (1233X23X32). ;) Do you have any idea how to use with this relative naming for example {queestion_name} ?

I also need to hit "enter" buttons for new fields to get this work for conditioning array perfilled answers on the same page - any help for this?

Thank you very much.
Letzte Änderung: 1 Jahr 7 Monate her von kubaj.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Executing hidden question 1 Jahr 7 Monate her #94596

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4371
  • Dank erhalten: 829
  • Karma: 381
Do you have any idea how to use with this relative naming for example {queestion_name} ?
Have a look at Expression Manager Access to Variables - docs.limesurvey.org/Expression+Manager&s...#Access_to_Variables

I also need to hit "enter" buttons for new fields to get this work for conditioning array perfilled answers on the same page - any help for this?
I think you are referring to triggering conditions when prefilling elements. You will need to add code to fire the checkconditions() function to your prefill script. (use a tool like Firebug to explore the keyup or change attributes of the elements)
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Letzte Änderung: 1 Jahr 7 Monate her von tpartner.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Executing hidden question 1 Jahr 7 Monate her #94651

  • kubaj
  • kubajs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
thank you - finally this code works for me now:

var aktual_SGQA = '{self.SGQA}';
var coolVarParts = aktual_SGQA.split('X'); //to get rid of sub-questions ids

var aktual_id = coolVarParts[0] + 'X' + coolVarParts[1] + 'X' + '{self.qid}';

and the usage is for example this:
for ( var i = 1; i <= 5; i++ ) {
document.getElementById('answer'+aktual_id+'rowidwithoutnumber'+i+'_columnid').value = '0';}
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Executing hidden question 1 Jahr 7 Monate her #94657

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6551
  • Dank erhalten: 869
  • Karma: 257
Hello.

Think is very more easy to use:
{QID}
or
{self.qid}


QID ALLWAYS work.

Denis
PS: doc updated : docs.limesurvey.org/The+template+editor#Keywords
And add a link to keyword in EM
Letzte Änderung: 1 Jahr 7 Monate her von DenisChenu.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.142 Sekunden
Donation Image