Welcome, Guest
Username: Password: Remember me

TOPIC: Executing hidden question

Executing hidden question 1 year 2 weeks ago #94533

  • kubaj
  • kubaj's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 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)?
The administrator has disabled public write access.

Executing hidden question 1 year 1 week ago #94566

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
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.
The administrator has disabled public write access.

Executing hidden question 1 year 1 week ago #94587

  • kubaj
  • kubaj's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 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.
Last Edit: 1 year 1 week ago by kubaj.
The administrator has disabled public write access.

Executing hidden question 1 year 1 week ago #94596

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
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.
Last Edit: 1 year 1 week ago by tpartner.
The administrator has disabled public write access.

Executing hidden question 1 year 1 week ago #94651

  • kubaj
  • kubaj's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 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';}
The administrator has disabled public write access.

Executing hidden question 1 year 1 week ago #94657

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 5845
  • Thank you received: 715
  • Karma: 222
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
Last Edit: 1 year 1 week ago by DenisChenu.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.117 seconds
Donation Image