Intercept Next Button

More
1 year 5 months ago #138062 by codelogic
codelogic created the topic: Intercept Next Button
Feature I need to make:
An "are you sure" pop-up box for combos of answers that are valid but unlikely.

Possible Solutions
  1. JavaScript - I can do this but its goinging to be extreamly ugly to keep track of previous group questions, looking at input fields and switching attributes on the next button to prevent submissions when I don't want them to happen.
  2. Lime Plug-In - I'm guessing this is possible but I have some questions. I'm not nearly as proficient in PHP.

Questions
  1. Which event would be the best for intercepting the submission of a question group? Is it perhaps better to use something like 'beforeSurveyPage' and somehow go previous if my desired requirements are not met?
  2. Can you refer to previous user answers in PHP via a plug-in?

Please Log in to join the conversation.

More
1 year 5 months ago #138068 by DenisChenu
DenisChenu replied the topic: Intercept Next Button
For this kinf af feature, in don't see any reason to do it with a plugin. Seems really more a javascript dev.

$("#movenext").click seems the best solution

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 to join the conversation.

More
1 year 5 months ago - 1 year 5 months ago #138074 by Ben_V
Ben_V replied the topic: Intercept Next Button

codelogic wrote: An "are you sure" pop-up box for combos of answers that are valid but unlikely.


Personally, I try to use alerts pop-up boxes only for not valid answers, so if the answer is still valid I don't see why to intercept next button.

An option is to use an expression (in the help area or elsewhere) to inform the user that the entered value maybe outside common values...



BTW what's an "unlikely" answer? If you try several BMI calculators available on the web, 250 kgs for the weight could be tagged "unlikely value" for Europe but not for USA :ohmy:

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Attachments:
Last Edit: 1 year 5 months ago by Ben_V.

Please Log in to join the conversation.

More
1 year 5 months ago - 1 year 5 months ago #138116 by codelogic
codelogic replied the topic: Intercept Next Button

Ben_V wrote: An option is to use an expression (in the help area or elsewhere) to inform the user that the entered value maybe outside common values...


This is a really good idea and would be less work. I'll have to talk to my boss about this option.

Ben_V wrote: BTW what's an "unlikely" answer? If you try several BMI calculators available on the web, 250 kgs for the weight could be tagged "unlikely value" for Europe but not for USA :ohmy:


Example: A vehicle with 20 axles

Thanks Ben
Last Edit: 1 year 5 months ago by codelogic.

Please Log in to join the conversation.

More
1 year 5 months ago #138118 by codelogic
codelogic replied the topic: Intercept Next Button

DenisChenu wrote: For this kinf af feature, in don't see any reason to do it with a plugin. Seems really more a javascript dev.

$("#movenext").click seems the best solution


That's what I was thinking as well but I didn't realize tell i did some research that I can return false to block the submission. Which is a lot better then swapping attributes to block submissions. :laugh:

Your post made me research onclick functions in more depth. Thanks for the pointer.

Please Log in to join the conversation.

More
1 year 5 months ago #138412 by codelogic
codelogic replied the topic: Intercept Next Button
Problem: You can use JQuery click function to intercept and block Lime Survey from going to next but its a race. If your function takes to long to return false it will not block Lime Survey from going forward.

Solution: Any Ideas on how to block Lime Survey without racing to a false return?
  1. The only one that comes to my mind is switching the name and class tags back and forth in order to turn the next button "on and off" at least as far as LimeSurvey is concerned.

Please Log in to join the conversation.

More
1 year 5 months ago #138656 by codelogic
codelogic replied the topic: Intercept Next Button

codelogic wrote: Problem: You can use JQuery click function to intercept and block Lime Survey from going to next but its a race. If your function takes to long to return false it will not block Lime Survey from going forward.

Solution: Any Ideas on how to block Lime Survey without racing to a false return?

  1. The only one that comes to my mind is switching the name and class tags back and forth in order to turn the next button "on and off" at least as far as LimeSurvey is concerned.


disregard this. It is the case for me that alerts stop working after the page has been loaded for a while but that't not the case with a clean install.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!