thanks your rapid reply. 2008/9/19 Thomas Weidner <[EMAIL PROTECTED]>
> Jacky, > > this is not supported for now and has been reported several times in the > last few days. > A issue is already filled and in work. > > Greetings > Thomas Weidner, I18N Team Leader, Zend Framework > http://www.thomasweidner.com > > ----- Original Message ----- From: "Jacky Chen" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Friday, September 19, 2008 8:47 AM > Subject: [fw-general] Bug with Zend_File_Transfer > > > > it seem that each validation for the file elements in the zend_form would >> validate all of the file elements in the form.it means that if there have >> two file elements in the form,says A and B. So isValid() for the element A >> is called,it would validate A and B,not just A. >> >> So if i want to upload two files, one is option, and another is >> required,then would result in error if i left the option one empty. >> >> do you understand me? if you don't , try the following: >> >> <?php >> >> $form = new Zend_Form(); >> $form->setEnctype(Zend_Form::ENCTYPE_MULTIPART); >> >> // file a,optional >> $a = new Zend_Form_Element_File('A'); >> $a->setLabel('file a'); >> $form->addElement($a); >> >> // file b,required >> $b = new Zend_Form_Element_File('B'); >> $b->setLabel('file b'); >> $b->setRequired(true); >> $form->addElement($b); >> >> if ($this->_request->isPost()) { >> if ($form->isValid($_POST)) { >> echo 'valid'; >> } else { >> echo 'invalid'; >> } >> } >> echo $form; >> >> >
