So, what your saying is that this is expected behavior? thomasW wrote: > > Still you have only one form. Even if there are 2 or 10 elements in that > form... it's only one form. > As I said before the whole form is transferred from your browser to the > server. > When you don't do the validation at the client-side (by using Dojo for > example) there is no way to see which part of the form failes validation. > > The HTTP protocol always transfers whole forms and not parts of a form. > > When you need to seperate between different elements then you must create > different forms but this integrates new problems as you can't submit two > forms at the same time. > > Greetings > Thomas Weidner, I18N Team Leader, Zend Framework > http://www.thomasweidner.com > > ----- Original Message ----- > From: "gerardroche" <[email protected]> > To: <[email protected]> > Sent: Friday, June 12, 2009 7:12 PM > Subject: Re: [fw-general] Zend_Form_Element_File? > > >> >>>What do do you mean with "name fales validation" ? >>>The file element is a part of the form which is transferred. >>> >>>This means that your browser submits all data (including the file) and >>>then >>>this data is validated. >>> >>>Greetings >>>Thomas Weidner, I18N Team Leader, Zend Framework >>>http://www.thomasweidner.com >> >> You read it wrong. >> >> There are two elements in the form. >> >> 1. name (which is a text element) >> 2. photo (which is a file element) >> >> The name *element* (1) is required and has a string length validator of >> between 1 and 255 characters. >> >> The photo *element* (2) has several validators. >> 1. Count equals 1 >> 2. Size less than 202400 >> 3. Extension is "jpg" and lowercase >> 4. The file is a "jpeg" image. >> >> i.e. >> >> $this->addElement('text', 'name', array( >> 'label' => 'Name', >> 'required' => true, >> 'validators' => array( >> array('StringLength', false, array(1, 255)) >> ), >> 'maxlength' => 255 >> )); >> $file = $this->createElement('file', 'photo', array( >> 'label' => 'Photo', >> 'destination' => 'images/photos', >> 'validators' => array( >> array('Count', false, 1), >> array('Size', false, 202400), // 102400 100K >> array('Extension', false, array('jpg', 'case' => true)), >> array('IsImage', false, 'jpeg'), >> ) >> )); >> $this->addElement($file); >> >> >> >> >>>What do do you mean with "name fales validation" ? >> >> I didn't say that, i said "the name element *fails* validation", note the >> "element". As i said above, there are two elements: one is a file element >> (photo) and one is a text element (name). >> >> Now if you add a file to upload (i.e. in the above example you attach a >> photo to the form for upload) and the name element (i.e. the text >> element) >> *fails* validation the file is still uploaded to the "images/photos" >> folder. >> >> Is this correct behavior, a bug or something wrong/bad in my code >> elsewhere? >> >> NOTE: The name *element" fails validation: The name element is the text >> element, if no name is given or a name is more than 255 characters long >> the >> name element will *fail* validation. >> >> -- >> View this message in context: >> http://www.nabble.com/Zend_Form_Element_File--tp23990412p24002884.html >> Sent from the Zend Framework mailing list archive at Nabble.com. > > >
-- View this message in context: http://www.nabble.com/Zend_Form_Element_File--tp23990412p24003745.html Sent from the Zend Framework mailing list archive at Nabble.com.
