Forums

how to change date format from yyyy/mm/dd to dd/mm/yy

temp2011 23 May, 2011
Hi,
I have set date format to dd/mm/yy through edit option in Date Fields Settings.
But in frontend(at actual form at frontend)it is still giving validation error as below--"Please enter a valid date in this format yyyy/mm/dd".
I have searched forum for this problem but only find that needs to hack code to solve this problem.
So what is the solution for this problem?
Is there any way to solve this problem by editing only settings?
thanks
GreyHead 23 May, 2011
Hi temp2011,

Is this CFv3?

Validation is completely separate to the date field format. There isn’t a built-in validation for dd/mm/yy so that would require a custom validation. You could switch to dd/mm/yyyy and use the validate-date-au validation.

Bob
hockeyozz 24 May, 2011
Bob,
I also have the same issue as temp2011 and so am VERY interested in the reply you posted. Being based in the US I have been asked to provide a mm/dd/yyyy input for our soccer team website registration page. How can this be done?

BTW .. great piece of code. Very easy to use and setup!

Thanks in advance.

Richard
PS. I am running v3.1 RC5.2 download.
GreyHead 24 May, 2011
Hi Richard,

There's a hack here to add a US date validation.

Bob
hockeyozz 25 May, 2011
Bob,
Thankyou for the reply and the hack .. most helpful.

Now being a newbie @ Joomla, but learning fast🙂, I just need to understand what you mean by:

>>This will let you put the validate-date-us into an input class to validate a date as mm/dd/yyyy

I see on the Validation Tab perhaps where you mean I need to look. If this is the case then I have 'Enabled Validation' and then added "validate-date-us" to the "9-validate-date-au" field on this TAB. Is this where I should put it?

I am PRETTY sure that the answer is staring me in the face but I think the terminology and applying it to ChronoEngine is where I fall down.

Thanks in advance.

Regards

Richard
GreyHead 25 May, 2011
Hi Richard,

The hack doesn't update the admin interface. You you have to 'apply' the validation by hand in the Form HTML box:
<input type='text' class='some_class validate-date-us' . . .  />

Bob
hockeyozz 27 May, 2011
Bob,
Thankyou for the comments and I was able to add the code to the Form Code/Form HTML section. I am now validating for a US Date (being from the UK I have to grin and bear the screwy date!).

The change I made was:
Old... class="cf_inputbox required validate-date"
New... class="cf_inputbox required validate-date-us"

Of course I'll have to remember to make the change after every update to the form - minimal issue after finding with your help the change!

Also found the 'Tooltip' feature useful for this date entry.

Again THANKYOU for your help. Great piece of code.

Regards

Richard
This topic is locked and no more replies can be posted.