Re: quickform required rule problem

From: Date: Tue, 19 Aug 2003 10:40:15 +0000
Subject: Re: quickform required rule problem
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7294@lists.php.net to get a copy of this message
Bertrand Mansion wrote:
<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 ? Thanks Bertrand, that works, I didn't know that rule existed, should have looked at the source.
Perhaps QF can throw an error if you try and use the required rule on file elements. Jeroen

« previous php.pear.general (#7294) next »