Dynamically Disabling/Enabling Buttons
Posted: Fri Oct 31, 2014 3:59 pm
I've created a pair of functions for our RPG programmers to call from their Profound UI screens to dynamically disable or enable CSS buttons without having to make a round trip to the RPG program. They are trying to fire these from the [on change] event of a textbox widget.
My first question is: Is there something wrong with the way I'm doing this? We stepped it through Firebug and each line does execute without errors. The problem is that we are not seeing these changes take effect on the button in question.
We have also tried it two different ways. The first way is with the two properties ("disabled" and "css class 2") bound to RPG fields and set from RPG as *ON and "faded", respectively. The second way is with the two properties hardcoded in the screen as "true" and "faded", respectively. Under the first scenario the button becomes enabled (it's clickable) but remains faded (i.e., the css class is not being removed or the button is not being redrawn). Under the second scenario the button remains disabled (not clickable) *and* faded.
So, my second question is: If a property is bound to an RPG field, does this preclude being able to use the applyProperty() API to change the bound property's value?
In the end, though, my ultimate question is: How can we make this work? Thanks.
Code: Select all
/* ================================================================================
disableCssButton() sets the "disabled" property to "true"
sets the "css class 2" property to "faded"
then sets the "field type" property to force a redraw.
*/
wob.disableCssButton = function(elementId)
{
if (getObj(elementId).pui.properties["field type"] == "css button")
{
applyProperty(elementId, "disabled", "true");
applyProperty(elementId, "css class 2", "faded");
applyProperty(elementId, "field type", getObj(elementId).pui.properties["field type"]);
}
}
/* ================================================================================
enableCssButton() sets the "disabled" property to "false"
sets the "css class 2" property to " "
then sets the "field type" property to force a redraw.
*/
wob.enableCssButton = function(elementId)
{
if (getObj(elementId).pui.properties["field type"] == "css button")
{
applyProperty(elementId, "disabled", "false");
applyProperty(elementId, "css class 2", " ");
applyProperty(elementId, "field type", getObj(elementId).pui.properties["field type"]);
}
}
We have also tried it two different ways. The first way is with the two properties ("disabled" and "css class 2") bound to RPG fields and set from RPG as *ON and "faded", respectively. The second way is with the two properties hardcoded in the screen as "true" and "faded", respectively. Under the first scenario the button becomes enabled (it's clickable) but remains faded (i.e., the css class is not being removed or the button is not being redrawn). Under the second scenario the button remains disabled (not clickable) *and* faded.
So, my second question is: If a property is bound to an RPG field, does this preclude being able to use the applyProperty() API to change the bound property's value?
In the end, though, my ultimate question is: How can we make this work? Thanks.