I'm not sure if this is a feature or a bug in ad_form/form builder but I thought it's still good to know since tracking it down gave me a major headache.
I have this kind of element in ad_form:
{trigger_type:text(radio)
{label {[ad_decode $num_sub_actions 0 "Trigger Type" "Trigger Type<br>(Cannot edit because
task has child tasks)"]}}
{mode {[ad_decode $num_sub_actions 0 "" "display"]}}
{options {
{ "User task" user }
{ "Automatic timer" time }
{ "Initial action" init }
{ "Workflow" workflow }
{ "Parallel" parallel }
}}
{html {onChange "javascript:acs_FormRefresh('task');"}}
}
Now when this element is in display mode, all the options are grayed out and the current one (here "Workflow") is checked, just like it should. However, when submitted, $trigger_type is an empty string. Not "workflow" as expected. Nada.
I don't know if this behaviour is intended or not, but it was a major surprise for me. The problem is that applications usually trust that the field has a real value (it's a required field, after all) and when it's now set to empty string, they overwrite the current (and correct) value with that.
I catch this in simulation so that when the mode is update (this can't happen in insert mode, since trigger_type is a required field), I check for empty string in trigger_type and unset it if that's the case. However, I would feel more comfortable if ad_form would set the value correctly even if it's in the display mode.