Using a SELECT field to change visible fields

I have a manual SELECT field with values “Basic” and “Advanced”.

“Advanced” displays more fields. “Basic” displays fewer fields.

The field is set to reload the form on value change.

In an onLoad event, I check which was selected, and display or hide fields with sc_display_field().

When I select “Advanced”, the form changes as expected, but the SELECT field shows that “Basic” is selected.

How can I force a manual SELECT field to display its actual value in an onLoad event?

$current_mode = {Mode};

{Mode} = $current_mode; // Does nothing. It always displays the first manual SELECT item.

I discovered a workaround:

If I save the SELECT field’s value in a local variable within the onLoad event, and strip off extraneous single-quotes, that local variable can be used to set the current SELECT field’s value as the last step in the onLoad event.

The SELECT field has a manual lookup of Basic(Basic) and Advanced(Advanced). No single quotes…

Perhaps this belongs in the Bugs forum?