Jump to content

HTML QuickForm date validation


trav1

Recommended Posts

Hello everybody,

 

I hope this is the right forum/place to ask this kind of question. :-)

 

I would like to know how can I validate (i mean, for example, check if the user selected something from every select menu) a date (dFY) which has been added like this :

 

$form->addElement('date', 'dob', ENTRY_DATE_OF_BIRTH, array('format'=>'d-F-Y', 'language'=> $lng->language['code'], 'minYear'=>1900, 'maxYear'=> date('Y'), 'addEmptyOption'=>'true', 'emptyOptionText'=>'-', 'emptyOptionValue'=>'-' ) );

 

I tried with these rules but it seems that it doesn't work:

 

$form->addGroupRule('dob', stripslashes(ENTRY_DATE_OF_BIRTH_ERROR), 'callback', 'dobCheck');

 

or

$form->addRule('dob', stripslashes(ENTRY_DATE_OF_BIRTH_ERROR), 'number');

 

or (for every select)

 

$form->addRule('dob[d]', stripslashes(ENTRY_DATE_OF_BIRTH_ERROR), 'nonzero', null, 'client');

 

I have php-pear-1.4.9-4 and HTML_QuickForm 3.2.11.

 

Thankx,

Trav

Link to comment
https://forums.phpfreaks.com/topic/221432-html-quickform-date-validation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.