Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Regular expression problem 25 Feb 2012 21:29 #1447

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
This is my regex : ^((0[0-9])|(1[0-9])|(2[0-3]))$
Quite simple, i use it to validate an hour field. Correct values are 00 to 23, with two figures everytime, even is hour < 10.
When I use this regex, it validates when i fill the fields in form view, but i use a number like 07, then it gives me an error on "save". So i have a green checkmark, but saves are not saved.
Any idea why this doesn't work ?
Thanks,

Please Log in or Create an account to join the conversation.

Re: Regular expression problem 27 Feb 2012 13:37 #1465

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Did you modified the RegEx after Cook generation ?

Because Cook Self Service write this RegEx in two different languages.
- In javascript (JDom script) -> Determines the green tick or not before to submit the form.
- In Php (in the table file : tables/mytable.php)

If you get the error on save(), you should have a look in the check() function of your table.php

Can you confirm you are looking in the table validation (check() method) ?

After that, watch carefully what string you furnish to the JDate() class.

That's all. If both points are corrects, it works.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: Regular expression problem 27 Feb 2012 17:54 #1471

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
Thx for your answer.
No i did not modify RegEx after generation.
Do i still have to check the rest ?
^((0[0-9])|(1[0-9])|(2[0-3]))$ this won't work
^([0-9]|(1[0-9])|(2[0-3]))$ this works

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.056 seconds

This Component Generator is the REAL component generator. This tool is very easy to use and in a matter of minutes I was building a fully working extension. I was amazed with the end result... worth every cent...
Griiettner (JED)

         

Get Started