Disable partial validation of forms by default

This commit is contained in:
Johannes Meyer 2014-11-18 15:04:11 +01:00
parent 38ef33276a
commit 760bf1a020

View File

@ -101,6 +101,13 @@ class Form extends Zend_Form
*/ */
protected $uidElementName = 'formUID'; protected $uidElementName = 'formUID';
/**
* Whether the form should validate the sent data when being automatically submitted
*
* @var bool
*/
protected $validatePartial = false;
/** /**
* Default element decorators * Default element decorators
* *
@ -333,6 +340,29 @@ class Form extends Zend_Form
return $this->uidElementName; return $this->uidElementName;
} }
/**
* Set whether this form should validate the sent data when being automatically submitted
*
* @param bool $state
*
* @return self
*/
public function setValidatePartial($state)
{
$this->validatePartial = $state;
return $this;
}
/**
* Return whether this form should validate the sent data when being automatically submitted
*
* @return bool
*/
public function getValidatePartial()
{
return $this->validatePartial;
}
/** /**
* Create this form * Create this form
* *
@ -580,8 +610,8 @@ class Form extends Zend_Form
|| ($this->onSuccess === null && false !== $this->onSuccess()))) { || ($this->onSuccess === null && false !== $this->onSuccess()))) {
$this->getResponse()->redirectAndExit($this->getRedirectUrl()); $this->getResponse()->redirectAndExit($this->getRedirectUrl());
} }
} else { } elseif ($this->getValidatePartial()) {
// The form can't be processed but we want to show validation errors though // The form can't be processed but we may want to show validation errors though
$this->isValidPartial($formData); $this->isValidPartial($formData);
} }
} else { } else {