What exactly is the feature request?
For batch form operations, a new Zend_Form method named something like
"clearAndPrepForRePopulate()". It would recursively clearAllMessages(),
including those in all elements and subForms, as well as set _errorsExist to
FALSE.
So it would like:
$form = getForm();
foreach($dataSet as $record) {
$form->populate($record);
if($form->isValid)
// do CRUD...
else
// handle errors...
$form->clearAndPrepForRePopulate();
}
If you check out Zend_Form, it has been designed such that when its
> cloned, it will actually enforce cloning throughout all of its consumed
> objects (elements, sub-forms, and display groups). So it is already
> capable of being "safely" cloned.
Thanks for the confirmation that cloning is the best way. I'd guess that a
clearAndPrepForRePopulate() method would be faster than cloning, but for now
I'll just create a static $form and clone it for each iteration of the batch
operation. If performance is poor I'll extend Zend_Form and try my own
clearAndPrepForRePopulate().
Thanks!
Chris
--
View this message in context:
http://www.nabble.com/Zend_Form-clearErrorMessages-vs.-clone-the-object-tp25285029p25373853.html
Sent from the Zend Framework mailing list archive at Nabble.com.