PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old July 26th, 2006, 03:29 PM
qali qali is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 93 qali User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 50 sec
Reputation Power: 2
quickform - regex

hi,
It weird. The regex function does not seem to work at all when I create rules.
Does anybody have it working?

$form->addElement('text', 'time_spent', '<b>Time Spent On Activity</b><br><font class="mainsmall">hh:mm', 'size="10", maxlength="5"');
$form->addrule('time_spent', 'Please enter a valid Time Spent on your Activity', 'required', 'regex', '/^[0-9]{2}:[0-9]{2}$/', null, 'server');


Reply With Quote
  #2  
Old July 27th, 2006, 04:47 AM
marksu marksu is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 21 marksu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: quickform - regex

Sorry not quite understand your problem but just found some related info here.

http://pear.php.net/bugs/bug.php?id=1810

Maybe it helps?
I not sure it that is your problem?

Reply With Quote
  #3  
Old July 27th, 2006, 07:00 AM
qali qali is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 93 qali User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 50 sec
Reputation Power: 2
RE: quickform - regex

sorry for not being clear,
What I meant was that the regex rule is not applied at all. I am able to enter any value for the 'time_spent' form element. The regex rule should not validate the form if the format of the data enetered is not ^[0-9]{2}:[0-9]{2}$ .
At the minute the rule only checks if the form element is not blank.

Reply With Quote
  #4  
Old July 27th, 2006, 07:42 AM
qali qali is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 93 qali User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 50 sec
Reputation Power: 2
RE: quickform - regex

I fixed it.
I don't know if it's optimized bt it's the best way I found.
It looks like the regex rule does not like the 'required' keyword.
To make the field required, I added a minlength rule.

$form->addElement('text', 'time_spent', '<b>Time Spent On Activity</b><br><font class="mainsmall">hh:mm', 'size="10", maxlength="5"');
$form->addrule('time_spent', 'Please enter a valid Time Spent on your Activity', 'required', 'minlength', '1', null, 'server');
$form->addrule('time_spent', 'Please enter a valid Time Spent on your Activity', 'regex', '/^[0-9]{2}:[0-9]{2}$/', null, 'server');

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > quickform - regex


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT