Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Disable survey if no javascript

  • jsansonn
  • jsansonn's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 1 month ago - 8 years 1 month ago #131193 by jsansonn
Disable survey if no javascript was created by jsansonn
Hi !

Is there a way to prevent completion of a survey / disable a survey if javascript is disabled on the user's computer?
Thanks for your help, regards,
Last edit: 8 years 1 month ago by jsansonn. Reason: more polite
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago #131221 by tpartner
Replied by tpartner on topic Disable survey if no javascript
A simple way, although not completely tamper proof, would be to hide the "Next" button with CSS and then show it with JavaScript.

This in template.css:
Code:
#movenextbtn,
#movesubmitbtn {
  display:none;
}

And this in template.js:
Code:
$(document).ready(function() {  
  $('#movenextbtn, #movesubmitbtn').show();
});

A more secure method would be to remove the {NAVIGATOR} placeholder from navigator.pstpl and insert the navigation buttons with JavaScript. Details of that script would vary by template and you would need to find a way to detect the last page so you could insert a "Submit" button instead of a "Next" button.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago - 8 years 1 month ago #131242 by DenisChenu
Replied by DenisChenu on topic Disable survey if no javascript

tpartner wrote: A more secure method would be to remove the {NAVIGATOR} placeholder from navigator.pstpl and insert the navigation buttons with JavaScript. Details of that script would vary by template and you would need to find a way to detect the last page so you could insert a "Submit" button instead of a "Next" button.

Think,
Maybe ,
Code:
<div id="navigatot-js"></div>
<script>
$(function() {
var navigator="{htmlentities(NAVIGATOR)}";
$(navigator).appendTo("#navigatot-js");
});
</script>

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 8 years 1 month ago by DenisChenu. Reason: Thanks holch
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago #131258 by tpartner
Replied by tpartner on topic Disable survey if no javascript
Yep, looks good :)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago - 8 years 1 month ago #131294 by holch
Replied by holch on topic Disable survey if no javascript
Shouldn't it be:
Code:
$(navigator).appendTo("#navigatot-js");

So "(navigator)" and not "(navigator}"?

If no, why not? (trying to update my JS skills... B)

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 8 years 1 month ago by holch.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago #131296 by tpartner
Replied by tpartner on topic Disable survey if no javascript
Yep, good catch. ;)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago #131307 by DenisChenu
Replied by DenisChenu on topic Disable survey if no javascript

holch wrote: So "(navigator)" and not "(navigator}"?

You're right :)

Did you try ? It work ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago #131340 by holch
Replied by holch on topic Disable survey if no javascript
No, I didn't test it.

I just tried to understand what was done and saw that bracket which confused me.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
8 years 1 week ago #132758 by jelo
Replied by jelo on topic Disable survey if no javascript
I am bit confused.
Shouldn't Limesurvey prevent entering surveys with disabled javascript on client side out of the box?
Or demand enabling Javascript to carry on?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 week ago #132775 by tpartner
Replied by tpartner on topic Disable survey if no javascript

Shouldn't Limesurvey prevent entering surveys with disabled javascript on client side out of the box?

No, I don't think so. Most basic question types will work without JavaScript although Expression Manager functionality will be impaired. I have several clients who insist that their surveys be fully accessible, even without JavaScript.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 1 week ago #132776 by jelo
Replied by jelo on topic Disable survey if no javascript

tpartner wrote: No, I don't think so. Most basic question types will work without JavaScript although Expression Manager functionality will be impaired.

I would like to see a serverside only version of LS, but isn't LS 2.5 and LS 3.0 working without Javascript for respondents?
I am not sure the serverside checking is completely implemented. Wouldn't be surprised if more functionality has moved to the client.
I don't trust the client. Mobile devices haven't made it easier to convice me about moving code to the client.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 week ago #132778 by DenisChenu
Replied by DenisChenu on topic Disable survey if no javascript

jelo wrote: ....
I am not sure the serverside checking is completely implemented. ......

If it's not : this clearly a bug and must be fixed.

Actually , since a lot of uear : there are a miscontrol on single choice item (we don't control single choice item at server part : did the item exoist).

But in general : EM does the job client side + server side.

It can be easily tested with deactivating JS.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose