FormBuilder Date Picker Default To Blank Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

FormBuilder Date Picker Default To Blank

Post by webform »

I have a curious problem with a FormBuilder Date Picker field set to "Default To Blank" and required.

The Date Picker field is used for selecting birthdays as i need to know peoples birthdays.

But even though the field is set to "Default To Blank", most submitted forms is with the birthday field value set to today's date, which get me to suspect somehow a lot of users still get the Date Picker field default to today's date and submitting the form and bypassing the required field.

Or maybe they all have some kind of browser autocompletion setting today's date for the birthday field.

I've tried to gather users HTTP User Agent Info to see if i could find something in common, but so far the common thing seem to be all submitted forms with today's date set is desktop browsers and all forms with a correct birthday selected seem to be mobile browsers.

Anyone have any idea what's going on?
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: FormBuilder Date Picker Default To Blank

Post by paulbaker »

Are you able to share the URL?
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Date Picker Default To Blank

Post by webform »

Yes! It's https://casteriet.dk/opret-profil

The site is in danish and the birthday field is called "Fødselsdag".

I've tested in Safari, Chrome and FireFox on both Desktop, laptop, mobile phone and tablets and have no problem.

I can't figure out what is going wrong and why 3 out of 4 users submit today's date as their birthday.
If the date was random i would think the users did it on purpose. But then the date always corresponds with the same date the form is submitted, i suspect it's something else.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: FormBuilder Date Picker Default To Blank

Post by paulbaker »

Well I had a look at the page and its HTML and could not see anything obvious. I see you have autocomplete=off. In Chrome, my browser happily populates name, address etc. but not birthday. Same on my phone. Maybe someone else has some ideas.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: FormBuilder Date Picker Default To Blank

Post by DIGI3 »

I assume the three date dropdowns calculate into a hidden field - does that hidden field perhaps have a default? Or perhaps it's using browser localization so the formatting is inconsistent? Hard to tell without digging in but I don't think it's the visitors doing it through autocomplete or other means, I think it's something happening in the validation or later.
Not getting the answer you need? CMSMS support options
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Date Picker Default To Blank

Post by webform »

Your are properly right but i can't find the culprit.

I've tested in multiple browsers and platforms but can't replicate the error.

Maybe you're on to something about browser localization and i'll try to dig into that and see if the validation or date format is off.
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Date Picker Default To Blank

Post by webform »

I've tried to contact a handfull of the people submitting a form with wrong birthdate selected.

And most of them tell they had errors on the form when submitting either because they forgot a required field or tried to upload too big an image.

None of them noticed something wrong with the date picker.

I've tried to test the form and leaving out some required fields, but i can't recreate any problem with the date picker field.
On no occasion did the date picker field give any other value than my selected date. So i'm stumped for now whats going on ???
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Date Picker Default To Blank

Post by webform »

Now i'm getting somewhere with finding the error.

If the user has selected certains months in the date picker, then my output is current date for the submitted form;

These months fails:
January
February
March
May
October

Any other months selected gives my the correct date!

I'm passing my form data to a session and in my error tracking i've noticed this:

Code: Select all

Selected date in the forms date picker: 10 October 1966
{$smarty.session.fbparams.birthday} outputs = 10 October 1966
{$smarty.session.fbparams.birthday|date_format:'%Y-%m-%d'} outputs = 2021-02-09
{$smarty.session.fbparams.birthday|date_format:'%Y'} outputs = 2021
What am i doing wrong to get this output?
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Date Picker Default To Blank

Post by webform »

Digi3 was correct - It was the formatting; I've forgot to change the "Date Format for display" for the field "Birthday", so it was at it's default value (j F Y). :-[

I've changed it to "Y-m-d" and now the dates is handled correctly.
Post Reply

Return to “Modules/Add-Ons”