Welcome to the LimeSurvey Community Forum

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

Datepicker plugin - Prevent multiple entries

  • gardalid
  • gardalid's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #171907 by gardalid
Hello

I am a relatively new developer. I have been tasked with modifying the jquery date-picker for a client. The client wants old entries in the survey date-picker to be disabled, and as such, prevent multiple entries on the same date.


I recon it is possible to gather the data, by registering to specific events and use the API to fetch the data. But is it in anyway possible to pass the data(gathered with php) to the jquery date-picker?


Best regards Sam
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
6 years 4 months ago #171925 by LouisGac
Replied by LouisGac on topic Datepicker plugin - Prevent multiple entries
"The client wants old entries in the survey date-picker to be disabled"

I don't understand: could you expand please, by giving more details about the use case?
The topic has been locked.
  • gardalid
  • gardalid's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #171948 by gardalid
Replied by gardalid on topic Datepicker plugin - Prevent multiple entries
Hi LuisGac

Our client is a group of doctors (allergy specialists), which use the platform to monitor development of their patients. The patients make a daily entry in the system, answering a few questions about their disease and progress. Some patients will fill out more than one survey each day, if they are being monitored for more than one disease.

The patients will inevitably have some days on which they do not have any irritation or bother from the disease, and will mostly forget to make an entry on these days. For that reason we included a date-based question in the first question-group of each survey, to let patients make entries for earlier days. i.e. the days on which they forgot to make an entry. But the clients problem is, that they want their patients to see which days already have entries.

So the question is, whether it is possible to gather the old dates for a token and a particular survey, and save them in an js object, which can be used to disable old entry dates in the date-picker itself.

We are using the system pretty much 'as is', meaning, that we have not made any changes in our installation, but only use the included features at the moment.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 4 months ago - 6 years 4 months ago #171955 by DenisChenu
Replied by DenisChenu on topic Datepicker plugin - Prevent multiple entries
beforeQuestionRender event since you need to get existing values in your Response table you can't use (i think) twig files from this.

Something like (really speedly done, without any control).
Code:
$token = Yii::app()->getRequest()-getPost('token');
$sid = $this->getEvent()->get('surveyId');
$column = $this->getEvent()->get('surveyId').'X'.$this->getEvent()->get('gid')."X".$this->getEvent()->get('qid');
$oResponse = Reponse::model($sid)->findAll("token = :token",array(":token"=>$token));
$listDate = CHtml::listData($oResponse,$id,$column);// Here you have the array of existing date
$script = "//TODO"; // Here you do you javascript
Yii::app()->getClientScript()->registerScript('filterDate'.$this->getEvent()->get('qid'),$script);

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 6 years 4 months ago by DenisChenu. Reason: typo + // Here you have the array of existing date
The following user(s) said Thank You: LouisGac, gardalid
The topic has been locked.
  • gardalid
  • gardalid's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #171994 by gardalid
Replied by gardalid on topic Datepicker plugin - Prevent multiple entries
Hi Denis

On the page with plugin events, it says that the event (BeforeQuestionRender) is available from LS v. 2.05 build 140922. We have the right version, but our build is 140618. Is there any way of updating to a newer build without having to do a version jump?? We would rather not have to redesign our templates(according to the documentation, templates were changed in v 2.5 or 2.6), as our surveys are currently in use. Or is there any other event that could handle our issue and is available in our build? like AfterFindSurvey?

Best regards
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 4 months ago #171996 by Joffm
Hi,
here you find the older versions.

You can update to 2.06 to keep the structure of your templates.

www.limesurvey.org/downloads/category/24-archived-releases

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, gardalid
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 4 months ago #172004 by DenisChenu
Replied by DenisChenu on topic Datepicker plugin - Prevent multiple entries
Then : with an older version : only solution : make a php script call in ajax.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: gardalid
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 months 1 week ago #258241 by Mazi

The client wants old entries in the survey date-picker to be disabled, and as such, prevent multiple entries on the same date.
 

One option is using a single choice question instead of a date picker. When making use of this plugin you can set a limit of 1 for each option and once that date was selected, the plugin will disable it so others won't be able to pick this option.

Best regards/Beste Grüße,
Dr. Marcel Minke
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose