Thanks Rondev, this seems to be working now!
Hi Tom,Thanks for your reply - unfortunately the logic still doesn't work. I've attached a .qsf of a dummy trial below - the full experiment is much larger and made up of multiples of these trials.Many thanks, ChrisSlider_Proto.qsf
Hi, “Choice” is set in intervention2 and that seems to work.WTP_Random and WTP_Subject are set in WTP_1, please find the code below:Qualtrics.SurveyEngine.addOnload(function(){ /*Place your JavaScript here to run when the page loads*/ }); Qualtrics.SurveyEngine.addOnReady(function(){ /*Place your JavaScript here to run when the page is fully displayed*/ }); Qualtrics.SurveyEngine.addOnUnload(function(){ /*Place your JavaScript here to run when the page is unloaded*/ }); Qualtrics.SurveyEngine.addOnPageSubmit(function(type){ if(type == "next") { Qualtrics.SurveyEngine.setEmbeddedData("WTP_Random",(Math.random() * (0.21 - 0.0) + 0.0).toFixed(2)); Qualtrics.SurveyEngine.setEmbeddedData("WTP_Subject", jQuery("#"+this.questionId+" .ResultsInput:eq(0)").val()); console.log("${e://Field/WTP_Random}"); console.log("${e://Field/WTP_Subject}"); }});
https://www.qualtrics.com/community/discussion/comment/29328#Comment_29328Thanks rondev, could you tell me where I should put this in the default brackets (eg "addOnLoad" or "addOnReady"? And is there any way to display the output while previewing a question? I have a lot of these single slider questions so would like to check before pasting it into all of them. Thanks a lot!
Hi Everyone,Suppose I ask about the balance on each of the following credit/store cards, where these five cards fields are based on carry forward text (that asked how many of each product the respondent has):I then want to ask about the monthly repayment, but only for cards that have a positive balance at the previous question.I can’t seem to add this display logic to the carry forward choices. Is there a way to do this in Javascript or some other method? Thanks!
Brilliant, that worked. Many thanks!
> @TomG said: > > @cjohnburke said: > > Hi Tom, > > thanks for the suggestion. Is there a way to direct participants to a specific question or block based on an answer sing javascript at the end of the question? > > No, not directly. You can use JS to set an embedded data field then base display logic or branch logic on that field. Thank you Tom, is there a way to set an embedded data field as the response to a multiple choice question? I have a lot of questions so would prefer to not use the hard-coded QR-QID21-4 type route but a this.QuestionID type javascript. Would it go in the "page unload" section of the JS editor?
Hi Tom, thanks for the suggestion. Is there a way to direct participants to a specific question or block based on an answer sing javascript at the end of the question?
Thanks Jen, I tried using branch logic but indeed it does get cumbersome and seems as there would need to be a definite end for each possible path of comparison. Our participants should basically be able to compare 4 different products (each on a separate page/block/question).
Thank you @NiC ! THis worked. The other thing that worked was disabling page transitions in the look and feel editor.
Thank you @Subu!!
Thank you so much, this solution worked.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.