when no file is selected.
I have setRequired(), but no errors is thrown. setRequired() defaults to
true.
I also have an Extension validator, which does get thrown WHEN there is a
file, and it's the wrong file type.
Note that I never see my custom message, but rather the default error for
the Extension validation.
Errors are thrown when file is attached, but not when they are not.
[code]
$this->_formElements = array(
'account_file' => $this->createElement('file', 'account_file')
->setLabel('File: ')
->setRequired()
->addValidator('Extension', false, 'jpg,png,gif,psd')
->addErrorMessage('you need a file'),
'submit' => $this->createElement('submit', 'Save', array('value' =>
'Click to Upload', 'class' => 'fileFormButton'))
);
[/code]
So do you have to have a file attached, for setRequired() to be considered?
thanks
--
View this message in context: http://www.nabble.com/setRequired%28%29-doesnt-seem-to-be-working-on-file-element-tp25933844p25933844.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论