Re: QuickForm (QF): trouble with a group of 'file' elements and group rules
| From: | Mark Wiesemann | Date: | Wed, 06 Dec 2006 06:56:15 +0000 |
| Subject: | Re: QuickForm (QF): trouble with a group of 'file' elements and group rules | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25983@lists.php.net to get a copy of this message | ||
jam@zoidtechnologies.com wrote:
> I have the following bit of code (with some things removed) that I am
> attempting to get working:
>
> -- begin code ---
> $form = new HTML_QuickForm("foo", "post", null, null,
> array("mimetype" => "multipart/form-data"));
> $form->addElement("header", "header", "example header");
> $images = array();
> for ($i = 0; $i < 10; $i++)
> {
> $images[] = &HTML_QuickForm::createElement("file", "", "Image
> {$i}");
> }
> $form->addGroup($images, "images", "Images", "<br />");
> $form->addGroupRule("images", "File size must be less than
> 512kilobytes", "maxfilesize", 512000);
> $form->addGroupRule("images", "File name must be *.jpg or *.jpeg",
> "filename", "/\.[jpg|jpeg]$/");
> $form->addGroupRule("images", "File must be of type jpeg image",
> "mimetype", array("image/jpeg"));
> $form->addGroupRule("images", "File must be uploaded",
> "uploadedfile");
> --- end code ---
Just a quick guess after a quick look on your code: You should try to
specify the $howMany parameter which defaults to 0 (which then might be
the reason for your form to be valid).
Regards,
Mark