Re: Re: QuickForm (QF): trouble with a group of 'file' elements and group rules
| From: | Mark Wiesemann | Date: | Wed, 06 Dec 2006 18:06:25 +0000 |
| Subject: | Re: Re: QuickForm (QF): trouble with a group of 'file' elements and group rules | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25988@lists.php.net to get a copy of this message | ||
jam@zoidtechnologies.com wrote:
--- begin code ---
$form = new HTML_QuickForm("sample", "post", null, null, array("mimetype" => "multipart/form-data"));
$form->addElement("header", "header", "sample");
$images = array();
for ($i = 0; $i < 10; $i++)
{
$images[] = &HTML_QuickForm::createElement("file", null, "Image {$i}");
}
$form->addGroup($images, "images[]", "Images", "<br />");
Just "images" is right here, without the brackets.
$form->addGroupRule("images[]", "File name must be *.jpg or *.jpeg","filename", "/\.[jpg|jpeg]$/", 10);Please try the following for this and the following lines: $res = $form->addGroupRule(...); if (PEAR::isError($res)) {
echo $res->getMessage() . '<br />' . $res->getUserInfo();} Apart from these two things, I have no ideas (and also no experience with grouped file elements). Regards, Mark