Custom error messages can be added to a form element:

The following shows how to add custom error message to a select element


$countryList = array("0" => "select" ,"1" => "Canada", "2" => "India", "3" => "America");
$countries = new Zend_Form_Element_Select('country');
$countries->setLabel("Country")
->setRequired(true)
->addFilter('Int')
->addMultiOptions($countryList)
->addValidator('GreaterThan',false, array("min"=>1, "messages" => array("notGreaterThan"=>"country is required")));


validator name = GreaterThan
message for = notGreaterThan ( get it from validator library file or api doc)

The customr error message will display now.

0 comments



Some Links (off programming)