Check out the LimeSurvey source code on GitHub!

Show Full responses in Completed page

More
3 years 11 months ago - 3 years 11 months ago #93405 by agabriel
Hi!LS Team,

Im running a survey that give a voucher to first 2,000 people only but accept unlimited people to answer the survey.

Im wondering if LS have a javascript code that can get the Full responses in a survey. Ill be inserting this code in the completed page template

Heres a sudo code example:
function get_voucher_button{
var total_responses = {TOTAL_RESPONSES}; //i dont know the placeholder for Total Responses
  if(total_responses > 2000){
   alert("sorry you didnt qualify for this voucher")
  }else{
   alert("click here to download voucher");
  }
}

Hope you can help me.

More power

Ali
Last Edit: 3 years 11 months ago by agabriel.

Please Log in to join the conversation.

More
3 years 11 months ago #93421 by DenisChenu
Hello,

Maybe you can use {SAVEDID} but it take the id if user don't finish him survey.

Alternative solution: use ajax on end message or your own script at endurl.

Denis

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).

Please Log in to join the conversation.

More
3 years 11 months ago #93496 by agabriel
Hi Denis!

is there a way i can query the database using Javascript?

Please Log in to join the conversation.

More
3 years 11 months ago #93497 by DenisChenu

agabriel wrote: is there a way i can query the database using Javascript?

No, not really.

You have to use own php script and call it in AJAX: api.jquery.com/jQuery.ajax/

Denis

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).
The following user(s) said Thank You: agabriel

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form