Changeset 2122
- Timestamp:
- 10/10/07 14:37:43 (15 months ago)
- Location:
- branches/0.11
- Files:
-
- 2 modified
-
CHANGELOG (modified) (1 diff)
-
src/filter/AgaviFormPopulationFilter.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/CHANGELOG
r2119 r2122 5 5 6 6 ADD: __sleep() and __wakeup() magic methods for AgaviModel to prevent Context serialization (#581) (David) 7 ADD: Ability to insert error messages into forms automatically using FormPopulationFilter (#303) (David )7 ADD: Ability to insert error messages into forms automatically using FormPopulationFilter (#303) (David, Ross Lawley) 8 8 ADD: AgaviWebResponse::unsetCookie() (#577) (David, Ross Lawley) 9 9 ADD: AgaviDoctrineDatabase (#381) (David, Ross Lawley) -
branches/0.11/src/filter/AgaviFormPopulationFilter.class.php
r2121 r2122 242 242 $forms = $this->xpath->query('//' . $this->ns . 'form[@action]'); 243 243 } 244 245 // an array of all validation incidents; errors inserted for fields or multiple fields will be removed in here 246 $allIncidents = $vm->getIncidents(); 247 244 248 foreach($forms as $form) { 245 249 if($populate instanceof AgaviParameterHolder) { … … 270 274 $remember = array(); 271 275 272 // an array of all validation incidents; errors inserted for fields or multiple fields will be removed in here273 $allIncidents = $vm->getIncidents();274 275 276 // build the XPath query 276 277 $query = 'descendant::' . $this->ns . 'textarea[@name] | descendant::' . $this->ns . 'select[@name] | descendant::' . $this->ns . 'input[@name and (not(@type) or @type="text" or (@type="checkbox" and not(contains(@name, "[]"))) or (@type="checkbox" and contains(@name, "[]") and @value) or @type="radio" or @type="password" or @type="file"'; … … 473 474 474 475 // now output the remaining incidents 475 if(!$this->insertErrorMessages($form, $errorMessageRules, $allIncidents)) { 476 $rq->setAttribute('lolz', $allIncidents, 'org.agavi.filter.FormPopulationFilter'); 477 } 478 } 476 if($this->insertErrorMessages($form, $errorMessageRules, $allIncidents)) { 477 $allIncidents = array(); 478 } 479 } 480 481 $rq->setAttribute('orphaned_errors', $allIncidents, 'org.agavi.filter.FormPopulationFilter'); 482 479 483 if($xhtml) { 480 484 $fiveTwo = version_compare(PHP_VERSION, '5.2', 'ge'); … … 579 583 protected function insertErrorMessages(DOMElement $element, array $rules, array $incidents) 580 584 { 585 if(!count($incidents)) { 586 // nothing to do here 587 return true; 588 } 589 581 590 $errorMessages = array(); 582 591 foreach($incidents as $incident) {

