Welcome to the LimeSurvey Community Forum

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

Prevent accidentially closing the survey

  • jonsen
  • jonsen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 11 months ago #107916 by jonsen
Replied by jonsen on topic Prevent accidentially closing the survey
I edited your post in the wiki...

Thanks and see you!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #107917 by DenisChenu
Replied by DenisChenu on topic Prevent accidentially closing the survey
And maybe it's best to use something like this:
Code:
if(!$('#submitted').length || $('.button,[name='move']').length)

Think it's best (have to test ...)

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.
  • jonsen
  • jonsen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 11 months ago #107997 by jonsen
Replied by jonsen on topic Prevent accidentially closing the survey

DenisChenu wrote:

Code:
$('.button,[name='move']').length


Yes, that's probably better than finding it out based on the <div>. I'm not sure if that then covers all cases...
The topic has been locked.
More
9 years 8 months ago #111049 by LS_SR
Replied by LS_SR on topic Prevent accidentially closing the survey
Where can I change the alert text and the alert-button text?

I tryed the program Poedit, but that's not working.
The topic has been locked.
  • jonsen
  • jonsen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 8 months ago #111050 by jonsen
Replied by jonsen on topic Prevent accidentially closing the survey
Hi LS_SR,

you can adapt the German sentences in the code (at e.returnValue and return) BUT for Firefox and similar browsers, the text is built-in and you cannot change it. You would need to rewrite the function for Firefox. Also, you cannot change the text of the button of javascript's alert() function, so you would have to use a differnet solution to implement an alert with a custom button, like using jQuery's alert functions...

Best
jonsen
The following user(s) said Thank You: LS_SR
The topic has been locked.
More
9 years 8 months ago #111051 by LS_SR
Replied by LS_SR on topic Prevent accidentially closing the survey
Thanks for your fast answer.
The topic has been locked.
  • Taereian_43648
  • Taereian_43648's Avatar
  • Visitor
  • Visitor
9 years 3 months ago #116036 by Taereian_43648
Replied by Taereian_43648 on topic Prevent accidentially closing the survey
Thanks a lot for your Code.
Do you now how it's possible to make en exception for the languagechanger?

Cheers
Benny
The topic has been locked.
  • jonsen
  • jonsen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 3 months ago #116038 by jonsen
Replied by jonsen on topic Prevent accidentially closing the survey
Hi fanepic,

please try to add ".changelang" to the jQuery "on" action by changing this:
Code:
$(document).on('click',".button,[name='move']", ...

to this:
Code:
$(document).on('click',".button,.changelang,[name='move']", ...

Please leave a quick comment if this works, otherwise I'll have a closer look.

Best
jonsen
The following user(s) said Thank You: Taereian_43648
The topic has been locked.
  • jonsen
  • jonsen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 3 months ago #116039 by jonsen
The topic has been locked.
  • Taereian_43648
  • Taereian_43648's Avatar
  • Visitor
  • Visitor
9 years 3 months ago #116042 by Taereian_43648
Replied by Taereian_43648 on topic Prevent accidentially closing the survey
Thank you jonson works fine.

Do you also now how to make it Multilanguage like only show if it's German?

Regards
fanepic
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #116085 by Mazi
Replied by Mazi on topic Prevent accidentially closing the survey
You can try using the {LANG} placeholder and maybe put everything into an IF statement like
...
if({LANG}=='de')
{
...
}

{LANG} should get replaced by Limesurvey with the current survey language.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • jonsen
  • jonsen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 3 weeks ago - 9 years 3 weeks ago #118624 by jonsen
Replied by jonsen on topic Prevent accidentially closing the survey
Hi everyone,

the code has been working well on all of my past surveys. BUT now I have a survey which contains a file uploader question and there IT DOESN'T WORK CORRECTLY!

How to replicate the problem:
1. Add the code ( manual.limesurvey.org/Workarounds:_Surve...y_closing_the_survey ) to your template.js
2. Add a file uploader question
3. Navigate through the survey. If you open the file uploader, you will be asked if you want to leave the page EVEN THOUGH you use the LS navigation (the "next" or "previous" buttons).
4. Notice that you will not have the this problem if you just pass through that question without opening the uploader iframe.

The function works based on a <input type="hidden" id="submitted" /> tag being added when using the navigation, which then again is being checked for by the "goodbye" function to see if the buttons were used. The interesting point: Even though this tag is appeded to the end of the <body> correctly when using the navigation (even after opening the file uploader), the goodbye function does not recognize it. How can this be? It works flawlessly for all other pages, why not here? Does it have something to do with the iframe (which is the only differnce to other pages that I can see)?

I'm really looking forward to a new perspective on this, as I have been stuck on this for a week now. Thank you very much!

Best
Jonsen
Last edit: 9 years 3 weeks ago by jonsen.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose