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
*/
protected $internalValidationMessage = "option not in list";
/**
* @var string default description for empty item
*/
private $internalEmptyDescription = "none";
/**
* @var array valid options for this list
*/
private $internalOptionList = array();
/**
* set descriptive text for empty value
* @param $value description
*/
public function setBlankDesc($value)
{
$this->internalEmptyDescription = $value;
}
/**
* setter for option values
......@@ -83,7 +97,7 @@ class OptionField extends BaseField
$result = array ();
// if relation is not required, add empty option
if (!$this->internalIsRequired) {
$result[""] = array("value"=>"none", "selected" => 0);
$result[""] = array("value"=>$this->internalEmptyDescription, "selected" => 0);
}
foreach ($this->internalOptionList as $optKey => $optValue) {
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