on 03-18-2006 10:27 AM
Hi, All
Please help me out I have to control the visibility of a button control from the click of a radio button.
Regards,
Jitender
First, decide if you want to make the button invisible or only disabled. Making it invisible might irritate the user.
To control the visibility, do this
1. Create a context attribute "ButtonVisibility" of type com.sap.ide.webdynpro.uielementdefinitions.Visibility (not Java native type WDVisibility)
2. Bind the "visible" property of the button to this context attribute.
3. Create an action to handle the radio button "onSelect" event. Set the "onSelect" property of the button to this action.
4. In the action handler, set the value of "ButtonVisibility" to WDVisibility.NONE or WDVisibility.VISIBLE.
To determine which radio button has been selected, you can look at the value of the context attribute that stores the selected key for the radio buttons (all "selectedKey" properties of the radio buttons in a group must be bound to the same context attribute)
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
First create an attribute 'buttonVisibiltiy' of type 'com.sap.ide.webdynpro.uielementdefinitions.Visibility' that u will find in Dictionary types, on clicking the button next to the 'type' property of a value attribute.
Create two radio buttons. Bind the 'selectedKey' property to a value attribute ('key') of type string. Now set 'keyToSelect' property of one radio button as 'r1' and another 'r2'.
Create an event say (selectRadio) and assign it to the 'onSelect' property of both radio buttons. Write following code:
if(wdContext.currentContextElement().getKey().equalsIgnoreCase("r1"))
{
wdContext.currentContextElement().setButtonVisibility(WDVisibility.VISIBLE);
}
else
{
wdContext.currentContextElement().setButtonVisibility(WDVisibility.NONE);
}
Regards,
Piyush.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Jithender,
If u have 2 radio buttons and u want the second radio button to be enabled then we have to set the properties like(First we have to create 3 attributes in context say R1,R2,Sel.)
RADIOBUTTON1:
Under properties
keyToselect : R1
selectedKey : Sel
RADIOBUTTON2:
Under properties
keyToselect : R2
selectedKey : Sel
under initilization
public void wdDoInit()
{
//@@begin wdDoInit()
wdContext.currentContextElement().setR1("Pass");
wdContext.currentContextElement().setR2("Fail");
wdContext.currentContextElement().setSel("Fail");
//@@end
}
so if we deploy this the second radiobutton will be enabled by deafult.
If we want the first Radio button to be enable by default then we have to change to
wdContext.currentContextElement().setSel("True");
During run time if we selecte the radio button its value will change automatically to the selected button value.
Hope ur satisfied.Pls reward points if ur satified with this.
REGARDS,
KrishnamRaju.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.