AnsweredAssumed Answered

How can I modify enum values on the fly?

Question asked by gperez gperez on Mar 18, 2014
Latest reply on Mar 31, 2014 by gperez gperez
I have a "type" field in my form, which is a dropdownlist  populated from a language file.

I added an "others" option. When that value is selected, user will fill another field, a text field, with that "other" value.

Now I need to display this custom value in the listView, but only for cases where the dropdownlist is set to 'other'. So I'm trying this but I just cannot overwrite the list value because it's an enum and the logic will only accept an existing value :(

function preDisplay() {    
     
     if (isset($this->bean) && !empty($this->bean->id)){
      if(empty($this->bean->type_c) || $this->bean->type_c == 'other'){
       $this->bean->type_c = $this->bean->custom_type_c; // Problem. Only existing enum values are accepted here 
}
     }
   
        parent::preDisplay(); 
    }    
         Do you see a different approach for this issue? 

Outcomes