insertans in template.js

Mehr
5 Jahre 6 Monate her #71077 von KRav
KRav erstellte das Thema insertans in template.js
Hi there,
is it possible to get a INSERTANS in template.js

Tried this with no success..


$(document).ready(function(){

var value = {INSERTANS:81754X121X2121};

....

is this not possible? How to get an answer in template.js


research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!

Bitte Anmelden um der Konversation beizutretten.

Mehr
5 Jahre 6 Monate her #71121 von Steve01
Steve01 antwortete auf das Thema: Aw: insertans in template.js
Hello,

I'm not sure but I think you can't use INSERTANS in Javascript. If you want to get an answer in your Javascript method you could perhaps do it by getting the answer from the element itself/its value. You can get an element by using "$('SELEKTOR')" provided by JQuery. For example, if you want to get the answer from 81754X121X2121 you can try something like
var value = $('#answer81754X121X2121').val();
But I think it will depend on what question you are using or what element you try to get/access.

Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team

Bitte Anmelden um der Konversation beizutretten.

Mehr
5 Jahre 6 Monate her #71123 von TMSWhite
TMSWhite antwortete auf das Thema: Aw: insertans in template.js
roB2009-

In LimeSurvey 1.92 (which should be available as a release candidate this week), you can use the new Expression Manager JavaScript functions to access the values.

Say your variable is called MyVar, you could either do this:
var value = LEMval('81754X121X2121');

or:
var value = LEMval('MyVar');

/Tom

Bitte Anmelden um der Konversation beizutretten.

Mehr
5 Jahre 6 Monate her #71128 von KRav
KRav antwortete auf das Thema: Aw: insertans in template.js
thank you both, for your response


research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 9 Monate her #85297 von KRav
KRav antwortete auf das Thema: Aw: Re: Aw: insertans in template.js
Hi Tom,

could you explain me the LEMval story a little bit more?

would it possible to "answer" a question from the template.js with it?

Pseudocode:

set radiobutton 1 of question xyx


research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 8 Monate her #86295 von TAdams
TAdams antwortete auf das Thema: Aw: Re: Aw: insertans in template.js
Hello roB2009, I have also had trouble assigning variables with INSERTANS in Jquery. I have not had any luck with var value = LEMval('81754X121X2121');.
Have you found success?

Thank you for your feedback.

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 8 Monate her #86297 von TMSWhite
TMSWhite antwortete auf das Thema: Aw: Re: Aw: insertans in template.js
TAdams-

You can only use code this:
var value = LEMval('INSERTANS:81754X121X2121');

If you also have something like this elsewhere on the page:
{INSERTANS:81754X121X2121}

or more easily (assuming that 81754X121X2121 is question q5):
{q5}

Expression Manager finds all variables within curly braces, and creates JavaScript arrays with metadata about them - but only for variables "declared" via those curly braces. So, if you use LEMval('q5') without putting {q5} somewhere on the page, LEMval() will return an empty string since there will be no entry for 'q5' in those JavaScript arrays.

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 3 Tage her #97295 von laxwcrb73c
laxwcrb73c antwortete auf das Thema: Aw: insertans in template.js
Hi,
while trying to prefill a Date question which did not work with setting the default
answer to {INSERTANS:184361X4X41} which results in an empty field or INSERTANS:184361X4X41 which results in always 03.12.1999 regardless of the parameter given
my attempt to examine where the problem is with the help of js stumbled over a buggy behavior:

debug('date_of_birth:' + LEMval('184361X4X41'));
fails on line 384 in em_javascript.js because the jsName usually defined in a hidden input within answers
seems to be missing on the datepicker type.
Where should I report this?

Cordially,
Axel

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 2 Tage her #97311 von DenisChenu
DenisChenu antwortete auf das Thema: Aw: insertans in template.js

axelhuizinga schrieb: Where should I report this?

www.limesurvey.org/en/community-services/bug-tracker

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden um der Konversation beizutretten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten