Welcome, Guest
Username: Password: Remember me

TOPIC: Array filter with exclusive option

Re:Array filter with exclusive option 4 years 2 months ago #48393

By setting that up as a default answer that will upset the skip logic as in some places checking that off, terminates the user.

Is there any other way to add in a static, exclusive option along with a filtered array?

I really need this to work for 2 questions then I'm all set.

Thanks.
d.
The administrator has disabled public write access.

Re:Array filter with exclusive option 4 years 2 months ago #48397

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4369
  • Thank you received: 828
  • Karma: 381
Darn, that kind of sets us back to JavaScript.

Well I can force the "none of the above" option to appear but if the respondent checks it, advances in the survey and then returns, the option will be unchecked by the filtering process.
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.

Re:Array filter with exclusive option 4 years 2 months ago #48399

That is ok. We do not allow the previous button and it will be token-based so they can only go one, way once.

If we do this with Javascript that is ok. I just need the code to use, I can modify it but wouldn't know where to begin by writing it from scratch.

I just need that static option to be available for the last two questions in the cascade series. Then if the user checks it there, they will term out.

That will finalize the survey once this is fixed and we can be done.

Thank you again for all your input.
Dawna
The administrator has disabled public write access.

Re:Array filter with exclusive option 4 years 2 months ago #48407

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4369
  • Thank you received: 828
  • Karma: 381
Assuming the survey is in question-by-question mode and that your "static" options are always last in the list, place the following script in the source of each question that you would like the last option to be permanently displayed:
<script type="text/javascript" charset="utf-8">
 
    $(document).ready(function(){
 
        window.setTimeout(function() {
            $('td.answer li:last').show();
            $('td.answer li:last input[type=hidden]:eq(0)').attr('value', 'on');
        }, 50);
 
    });
 
</script>
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.

Re:Array filter with exclusive option 4 years 2 months ago #48413

I will try that right now.

Do I keep the array filter on?

Thanks.
Dawna
The administrator has disabled public write access.

Re:Array filter with exclusive option 4 years 2 months ago #48414

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4369
  • Thank you received: 828
  • Karma: 381
Yup, turn on the filter for all questions.
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.

Re:Array filter with exclusive option 4 years 2 months ago #48415

Ok I did it and I changed the code of 50 to 98 but it won't show up. Drat!

I tried it both ways with your 50 and with my 98 which is the correct code.

Any ideas?

The browser says "done but with errors..."

Thanks.

Dawna
The administrator has disabled public write access.

Re:Array filter with exclusive option 4 years 2 months ago #48416

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4369
  • Thank you received: 828
  • Karma: 381
The 50 is just a 50 millisecond delay before firing the script so the filtering can happen first, it should be left alone.

What browser are you using? I tested with IE7 and Firefox.

Can you check the log to see what the errors are.

Failing that, can you activate the survey so I can check? (send me a PM with the URL if it's sensitive)
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.

Re:Array filter with exclusive option 4 years 2 months ago #48418

Ok I've put it back and still no go.

I'm using IE8 and I also tried Firefox. When I view the source it is in there....

I'll send you a PM with the link. It is a high-level sensitive survey for one of the big Social Networking companies.

Thanks so much for all your help with this.

Dawna
The administrator has disabled public write access.

Re:Array filter with exclusive option 4 years 2 months ago #48419

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4369
  • Thank you received: 828
  • Karma: 381
Although I don't get any JS errors I see the problem - it's the Limespired template messing things up.

Use this. I would also move it to the question help so it doesn't show in the alert that pops up if the question is unanswered. Note that this will only display the last option - gimme a minute to modify it to display the last two.
<script type="text/javascript" charset="utf-8">
 
    $(document).ready(function(){
 
        window.setTimeout(function() {
            $('.survey-question-answer li:last').show();
            $('.survey-question-answer input[type=hidden]:eq(0)').attr('value', 'on');
        }, 50);
 
    });
 
</script>
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.
Moderators: ITEd
Time to create page: 0.221 seconds
Donation Image