Skip mandatory questions via script

More
2 months 2 weeks ago #172051 by kensikat
kensikat created the topic: Skip mandatory questions via script
Hi everybody,

I'm setting a cookie via js so that participants who take the survey again dont have to answer the first two pages again (I want participants to take the survey more than once).
I know how to skip a page by activating the next button in my script. However it doesnt work when the questions are set to be mandatory.
I want them to be mandatory for the first time, so setting them to be non-mandatory is not an option sadly.

Does anyone know how to disable the mandatory feature for all questions on a page via js?
I wasnt able to find an answer with my search of the forums.

Advice would be greatly appreciated!

Greetings,
Kaspar

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #172056 by DenisChenu
DenisChenu replied the topic: Skip mandatory questions via script
Just enter some value via js too …

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 .

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #172057 by kensikat
kensikat replied the topic: Skip mandatory questions via script
That could work but is kind of an unelegant workaround. Since there are quite a few questions in different formats on those two that would be kind of a hassle. I was hoping for an easier solution.

Still, thank you for your quick answer. If there isnt any better solution, I'll have to go that way.

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #172060 by kensikat
kensikat replied the topic: Skip mandatory questions via script
So, I found the option to remove the class "mandatory" from all elements.

var mandatoryelems = document.querySelectorAll(".mandatory");
alert(mandatoryelems.length);

[].forEach.call(mandatoryelems, function(el) {
el.classList.remove("mandatory");
});

Still a prompt appears that tells me that not all questions have been answered and stops me from activating the next button.

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #172061 by DenisChenu
DenisChenu replied the topic: Skip mandatory questions via script
You use cookie … but if you use another system, for example token or prefill value by url or … etc …

You can use relevance on the first 2 group directly …

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 .

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #172062 by DenisChenu
DenisChenu replied the topic: Skip mandatory questions via script
Mandatory system is tested via PHP … hopefully …

Then 2 solution:
- Set relevance to 0
- Put a value in answer

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

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #172064 by kensikat
kensikat replied the topic: Skip mandatory questions via script
The first option sounds like the way to go.
Can you explain how I'd set that up to work? Or is there anything about it in the manual? If so, could you link it to me?

Thank you in advance!

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!