10389 Posts in 2200 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1727 Views |
-
Userforms date validation not working

7 September 2010 at 2:30am Last edited: 7 September 2010 2:35am
Hi!
I've been having a slight problem validating date picker fields with userforms.
If I create a date field and default it to today’s day it will be displayed in the format "6 Sep 2010" When this is submitted it validates.
If I then use the date picker to choose a different date it will be displayed in the format "09/07/2010" the page will be submitted and pass the javascript validation but you'll be redirected back to the form with an error message displayed: "Please enter a valid date format (d MMM yyyy)"
I've had a look through the source code and can’t find where this validation is done or where the default date output is created, Could anyone point me in the right direction.
On another note, I also can’t find the code that creates the javascript output; I’d like to change some of the validation rules there too.
I've put a test form up so any of you can take a look at http://formbuilder.kolin.me.uk/test/test-form/
I've also posted my template's Page.ss which isn’t particularly complicated file at http://pastie.org/1141548
Thanks in advance
Colin -
Re: Userforms date validation not working

7 September 2010 at 3:17am
I've found the solution to the first problem.
Changing line 51 of userforms/code/editor/EditableDateField.php from
$('input[name^=EditableDateField]').attr('autocomplete', 'off').datepicker();
to
$('input[name^=EditableDateField]').attr('autocomplete', 'off').datepicker({dateFormat: 'd M yy'});
Makes the date picker output the date in the same format as the current date.
Now just to find out where the rest of the javascript comes from.
-
Re: Userforms date validation not working

22 June 2011 at 3:42am
isn't this just managed by the locale you set in config?
it worked for me anyway... i added this:
// Set the site locale
i18n::set_locale('en_GB'); -
Re: Userforms date validation not working

1 November 2011 at 1:48am
I have a simulair problem, when you click on the datePicker, you get the date, but the validation says it's not correct/filled in.
I've downloaded the latest version from gitHub today.. but the validation is going wrong.
It displays the date as 31 Oct 2011 for instance.
i've set the site to dutch in the config
i18n::set_locale('nl_NL');
setlocale(LC_ALL, 'nl_NL');Any idea how to fix this?
-
Re: Userforms date validation not working

2 November 2011 at 6:57am Last edited: 2 November 2011 6:57am
first thing to check, the time/date settings for your user account under the security tab!
-
Re: Userforms date validation not working

24 October 2012 at 3:17pm Last edited: 24 October 2012 4:17pm
I'm having the same issue borriej.
I've check my date/time setting - all on Default. No difference, I still get a validation error that the field is empty when it clearly is not..Anyone else have any ideas?
**UPDATE
It seems that it only breaks if you create a DateField, make it required. Save it. And then change it back to being not required.
I deleted the instance of DateField that was being problematic, and added it again, and all seems to be working as expected.Should a bug like this be reported?
-
Re: Userforms date validation not working

27 November 2012 at 4:40am
We are experiencing the same issue with our sites. When we add 'required' to a date field suddenly the locale set to en_US when the system is setup for en_GB.
Weird!
If we find a solution we'll post.
-
Re: Userforms date validation not working

1 December 2012 at 5:52am
Report it and see what Will has to say since it seems others have it too?
| 1727 Views | ||
|
Page:
1
|
Go to Top |




