Commit 08c1e186 authored by Ad Schellevis's avatar Ad Schellevis

(mvc) add optional description for empty item in OptionField

parent e1dd1839
...@@ -47,11 +47,25 @@ class OptionField extends BaseField ...@@ -47,11 +47,25 @@ class OptionField extends BaseField
*/ */
protected $internalValidationMessage = "option not in list"; protected $internalValidationMessage = "option not in list";
/**
* @var string default description for empty item
*/
private $internalEmptyDescription = "none";
/** /**
* @var array valid options for this list * @var array valid options for this list
*/ */
private $internalOptionList = array(); private $internalOptionList = array();
/**
* set descriptive text for empty value
* @param $value description
*/
public function setBlankDesc($value)
{
$this->internalEmptyDescription = $value;
}
/** /**
* setter for option values * setter for option values
...@@ -83,7 +97,7 @@ class OptionField extends BaseField ...@@ -83,7 +97,7 @@ class OptionField extends BaseField
$result = array (); $result = array ();
// if relation is not required, add empty option // if relation is not required, add empty option
if (!$this->internalIsRequired) { if (!$this->internalIsRequired) {
$result[""] = array("value"=>"none", "selected" => 0); $result[""] = array("value"=>$this->internalEmptyDescription, "selected" => 0);
} }
foreach ($this->internalOptionList as $optKey => $optValue) { foreach ($this->internalOptionList as $optKey => $optValue) {
if ($optKey == $this->internalValue) { if ($optKey == $this->internalValue) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment