quickform required rule problem
| From: | Jeroen Houben | Date: | Tue, 19 Aug 2003 10:08:34 +0000 |
| Subject: | quickform required rule problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-7292@lists.php.net to get a copy of this message | ||
Hi,
The following code doesn't check if the file upload box is empty.
$form = new HTML_QuickForm;
$form->addElement('text','description', 'Description', 'size=75');
$file =& $form->addElement('file','file', 'File', 'size=40');
$form->addElement('hidden','action','insert'); //default value is insert
$form->addElement('hidden','doc_id');
$form->addElement('hidden','section_id', $page->section_id);
$form->setMaxFileSize(MAX_FILE_SIZE);
$form->addRule('description','Please provide a description','required');
$form->addRule('file','Please click "browse" and select a file to upload','required');
The addRule works for for all other elements except for the file element. Or am I doing something wrong? I'm using the latest stable QF.
TIA,
Jeroen