cancel
Showing results for 
Search instead for 
Did you mean: 

How can I disable a button ?

Former Member
0 Kudos

Hi!

How can I disable the a button ?

There is a if statement. If it returns a false the button must be disabled.

Regards

sas

Edited by: erdem sas on Jan 15, 2008 3:06 PM

Edited by: erdem sas on Jan 15, 2008 3:16 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Do it thru its action:


//Deactivate a button disabling its action
//You can see it but clicking it does nothing
wdGetACTION_NAMEAction().setEnabled(false);

//Get it's funcionality back
wdGetACTION_NAMEAction().setEnabled(true);

Or you could hide it using an attribute of type WDVisibility binded to its visible property.


//Hide it
wdContext.currentContextElement.setATTRIBUTE(WDVisibility.NONE);

//and Show it
wdContext.currentContextElement.setATTRIBUTE(WDVisibility.VISIBLE);

Regards.

Julio Herrera.

Answers (4)

Answers (4)

Former Member
0 Kudos

Or else you can make use of the predefined UI element data type "Visibility" from the list of data types under the UI element properties.You can disable the button or also you can hide the button totally according to your requirement.create a attribute and selcect the data type as "visibility" from the list of com.sap.uielementpropeties.Bind this to the attribute to the visibile property of the button.If you are making use of boolean then you can make it active or non active if you are making use of the visibilty data type then you can do many things to display or hide or hide with button occupying space occupying on the view.

former_member485701
Active Participant
0 Kudos

Hi erdem,

Bind the "enable" property of button to a boolean context attribute say "enabled".

Now in your if condition if you want to disable it use the following statement

wdContext.currentContextElement.setEnabled(false);

Regards,

Praveen

Former Member
0 Kudos

HI Sas

1) Create a boolean value attribute ,say isEnabled

2) Bind that to the enable property of the button

3) Depending upon the condition make the changes

ex: wdContext.currentContextElement.setIsEnabled("true");

or

wdContext.currentContextElement.setIsEnabled("false");

Best Regards

Chaitanya.A

Former Member
0 Kudos

You can disable the action assigned to "onAction" or bind the "enabled" property to a context attribute and set its value to false. You can also use a calculated context attribute and implement the condition in the get-method.

Armin