Re: quickform required rule problem
| From: | Bertrand Mansion | Date: | Tue, 19 Aug 2003 10:35:31 +0000 |
| Subject: | Re: quickform required rule problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7293@lists.php.net to get a copy of this message | ||
<jeroen@terena.nl> wrote :
> 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,
Hi Jeroen,
Did you try with 'uploadedfile' instead of required ?
Bertrand