Welcome to the LimeSurvey Community Forum

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

Bug? - Periodic error when users submit a date field

  • intavg
  • intavg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 3 months ago #128640 by intavg
I am getting a periodic error email when users submit a mandatory date field. This doesn't happen often, but it does mean users are getting kicked out of the survey. The field in question is a DateTime, with a max date of 2005, where the format is set to "mm - yyyy", the question is displayed as pulldowns, and the month is shown as full. There are no other settings or validations beyond the default. The survey version is 2.06+.

The e-mail I receive shows the following for the page where the date question is:

488965X31X428: INVALID
488965X31X367: A2
488965X31X564: 45

(45 is a hidden calculated field that uses the date field to calculate the respondent's age. For whatever reason, it defaults to 45 if the age is not entered. However, not entering an age should not be causing the survey to fail.)

At the bottom the report shows the following:

SQL CODE THAT FAILED:


ERROR MESSAGE:


This doesn't really give me much to go on to troubleshoot the issue. Any suggestions for how I can troubleshoot the issue so that I am not losing respondents? The users report they get an error that their session has expired and then they have to start over.
The topic has been locked.
More
8 years 3 months ago #128641 by fvanderstarre
Replied by fvanderstarre on topic Bug? - Periodic error when users submit a date field
Hi, to me this looks to be the same issue as described in the bug tracker (#09643): "Date/Time question with drop down values fails validation when only one value is selected and MySQL is not the database."
Still has to be fixed ....
Cheers, Frank
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • intavg
  • intavg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 3 months ago #128652 by intavg
Argh. That looks like my exact issue. Thanks for the info. The problem seems to be slightly worse - as I tried to find a workaround (we can't put a survey live with a glaring bug like this) I realized that I can't even make a datetime field mandatory. Even if nothing is selected, the page still submits. Even if I create a separate validation that just checks if a value is entered, because that is ignored as well.

I also tried adding javascript to the question, which does successfully check that both pulldowns have values, pops an alert, and prevents submission. However, once that happens, the submit button stops working.
The topic has been locked.
  • intavg
  • intavg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 3 months ago #129287 by intavg
So, after a lot of trial and error, this is the fix/workaround we came up with:

<script type="text/javascript">
$("form").on("submit", function( event ) {
var msg = '';
var not_valid = false;
if($("#month488965X31X428").val() == "") {
msg = msg+"Month is required\n";
not_valid = true;
}

if ($("#year488965X31X428").val() == "") {
msg = msg+"Year is required";
not_valid = true;
}

if (not_valid) {
alert(msg);
$('#movenextbtn').prop('disabled', false);
$('#movenextbtn').removeClass('active');
return false;
}
});
</script>
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose