I'm trying to control whether a form is editable or not using a local variable - with a button on the form that enables editing.

The initial state of the form is correctly evaluated.  However, when the button is clicked, although the EditMode variable is correctly set (using an Ajax Submit), the form does not change.

I assume that the If widgets on the form are only evaluated on initial load.  What is the correct way to manage this sort of behaviour?

Solution

Hi Ben,

Are you doing an Ajax Refresh in your Action.

Give the form (or any larger container containing everything that is influenced by the value of your local variable) a name, and then add an AjaxRefresh of that form or container in your action, after changing the value of your EditMode variable.

You are talking about If widgets, for the purpose of enabling / disabling editing, you could also make use of the 'Enabled' property of the form and buttons.  Unless you want to use expressions in the disabled state and inputs in the enabled or something like that...)

See attached oml for example, used both buttons and a checkbox to enable/disable

Dorine

Solution

Dorine Boudry wrote:

Hi Ben,

Are you doing an Ajax Refresh in your Action.

Give the form (or any larger container containing everything that is influenced by the value of your local variable) a name, and then add an AjaxRefresh of that form or container in your action, after changing the value of your EditMode variable.

You are talking about If widgets, for the purpose of enabling / disabling editing, you could also make use of the 'Enabled' property of the form and buttons.  Unless you want to use expressions in the disabled state and inputs in the enabled or something like that...)

See attached oml for example, used both buttons and a checkbox to enable/disable

Dorine

Thanks Dorine,

I had an Ajax Refresh, but it had the wrong scope.  Since you can't specify a placeholder for the refresh, I wrapped my controls in a container and then refreshed that container.  It works now.