Welcome, Guest
Username: Password: Remember me

TOPIC: Regular expression for time

Regular expression for time 14 Feb 2012 09:15 #1284

  • thierry
  • thierry's Avatar
  • Offline
  • Senior Member
  • Posts: 52
  • Thank you received: 2
  • Karma: -3
Hi,

Within my form I want to be able to enter a time : 09:00 for example.

I use the following reg ex :
([0-1][0-9]|2[0-3]):([0-5][0-9])
the table within cook is valid and the form I feel in the sandbox is OK but when I want to save I have this message : Wrong value for T/O time. Please retry.
Error

Do you have any idea ?

Thank you for your help,

Regards
Last Edit: 14 Feb 2012 14:54 by admin.
The administrator has disabled public write access.

Re: Regular expression for time 14 Feb 2012 10:42 #1285

  • thierry
  • thierry's Avatar
  • Offline
  • Senior Member
  • Posts: 52
  • Thank you received: 2
  • Karma: -3
Hi again,

I try many other reg ex and still have the same issue.
I got the green validation within the form at the frontend and backend but when I want to SAVE I've got same message : Wrong value for T/O time. Please retry.
Error


So I don't thing it is the REG EX that is involved.

How can I enter a time using AM PM or 24 hours and will work in the sandbox.

Thank you very much.

Regards
The administrator has disabled public write access.

Re: Regular expression for time 14 Feb 2012 14:31 #1292

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
If you don't get message alert box, the RegEx is ok.

But tell me please in the controller, what string is received by the post, and if the format send to the Time object is ok.

Remember that your form send a FORMATED string (can even be 'Sun 12th January'), and MUST be decoded before to pe parsed.

ex : 12/01/2012 must be decoded as 2012-01-12 before to be passed to JDate()

I didn't worked so much for Time objects, but I guess the problem come from that.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Regular expression for time 15 Feb 2012 14:43 #1317

  • thierry
  • thierry's Avatar
  • Offline
  • Senior Member
  • Posts: 52
  • Thank you received: 2
  • Karma: -3
admin wrote:
If you don't get message alert box, the RegEx is ok.
Yes I know the RegEx is OK, I didn't make it, I do not have this knowledge thus I took it from the web.
admin wrote:
But tell me please in the controller, what string is received by the post, and if the format send to the Time object is ok.

:sick: I'm sorry, you have to tell me how to provide this information. I don't know what is and where is the controller.

Will you please give to me the way to do it.

Thank you very much.
Last Edit: 15 Feb 2012 14:44 by thierry.
The administrator has disabled public write access.

Re: Regular expression for time 15 Feb 2012 16:28 #1320

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Can anybody help here ?


Just as a clue, the post is an array of informations that contains strings only.
'09:00' is a string. Joomla has to decode it with the JDate() class to transform it in a datetime object.
At this point fo example if you give '09-00' maybe JDate() don't understand.

TODO :
Understand what type of strings is waited by JDate().
convert your string to the right one.
Maybe : 0000-00-00 09:00:00 ... ;-)


For the moment, Cook doesn't handle time format.
So if you want it you should have changed some dates format.

I really do my best to improve everyday the soft, but in this case you have to try to solve it with the help of others users.

Model-View-Controller is the basis you have to understand if you want to modify the source code and post in this category.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.125 seconds

Get Started