Changeset 397 for branches/gettext
- Timestamp:
- 12/10/07 15:09:12 (9 months ago)
- Files:
-
- branches/gettext/patForms/Element/Enum.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/gettext/patForms/Element/Enum.php
r394 r397 433 433 $values = $this->getValues(); 434 434 435 if ($values === false) {435 if( $values === false ) { 436 436 $this->valid = false; 437 437 return false; 438 438 } 439 439 440 $empty = ( strlen( $value ) == 0 ); 441 if( $value == '0' ) { 442 $empty = true; 443 } 444 440 445 // required & empty 441 if( isset( $this->attributes["required"] ) && $this->attributes["required"] == "yes" && strlen( $value ) == 0 ) 442 { 446 if( isset( $this->attributes['required'] ) && $this->attributes['required'] == 'yes' && $empty ) { 443 447 $this->addValidationError( 1 ); 444 448 return false; … … 449 453 // is value in values list? 450 454 $found = false; 451 foreach( $values as $line => $optionDef ) 452 { 453 if( $optionDef["value"] == $value ) 454 { 455 foreach( $values as $line => $optionDef ) { 456 if( $optionDef['value'] == $value ) { 455 457 $found = true; 458 break; 456 459 } 457 } 458 459 if( !$found ) 460 { 461 $this->addValidationError( 2 ); 462 return false; 463 } 464 465 return true; 460 461 if( empty( $optionDef['value'] ) && $empty ) { 462 $found = true; 463 break; 464 } 465 } 466 467 if( $found ) { 468 return true; 469 } 470 471 $this->addValidationError( 2 ); 472 return false; 466 473 } 467 474
