Studyon Minte9.com
ZF 1.0




Errrors



#modules/default/Forms/Login.php
<?php
class Forms_Login extends Zend_Form {
	
	public function init() {
		
		$username = $this->createElement('text','username');
		$username->setRequired(true);
		$username->setLabel('Username');
		
		$password = $this->createElement('password','password');
		$password->setRequired(true);
		$password->setLabel('Password');
		
		$submit = new Zend_Form_Element_Submit("submit");
		$submit->setLabel("Submit");

		$this->addElements(array(
			$username,
			$password,
			$submit,
		));

	}
}

#processing (controller)
<?php
	...
	$form = new Forms_Login();
	if ($this->_request->isPost()) {
		if ($form->isValid($this->_request->getParams())) { // isValid - display errors
		}
	}

---
form.01.overview

// translations
// #Zend_Validate_NotEmpty (const IS_EMPTY = 'isEmpty')


http://zendguru.wordpress.com/2008/12/05/grouping-form-errors-for-display-purpose/