on 03-03-2009 4:04 PM
Hi Experts,
I have two radio buttons named yes and no. I need to keep no button as the default button selected
when the user logs in . Please suggest me how to do it.
Thanks a lot in advance.
Depends on if you use
- individual radio buttons
- RadioButtonGroupByKey
- RadioButtonGroupByIndex
In the first two cases, set the value of the context attribute to which the "selectedKey" property is bound to the value that selects the "no" button.
In the third case, set the lead selection of the context node to which the RadioButtonGroupByIndex is bound to the index corresponding to the "no" button.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srini,
if u are getting the values from BAPI , then use RadioButtonByIndex.
Create a Context node say "radio" and Attribute say "text".
Copy the Data from the Bapi to the this Context Node. and set the text property of the RadioButtonByIndex to this Context Node.
for more info, please refer this link :
[http://help.sap.com/saphelp_nwce711/helpdata/en/59/b2af840e67514f8e8973d97d494c9b/content.htm]
Thanks and Regards
Hi Srini,
If you are populating the values from the backend, you need to use RadioButtonGroupByIndex UI Element.
Your model node should be like this:
RBNode (0...n)
-code (String) (YES,NO)
-description(String) (Yes,No)
Bind the texts property of the RBByIndex.
You can select your desired value, like
wdContext.nodeRBNode().setLeadSelection(indexoftherecord);
regards,
Siva
Hi Srini,
To get the index of record use this code:
int indexoftherecord = wdContext.current<Node_Name>Element().index();
Also for you first question:
You can use either of them. If you use the value node then you have to take care of getting and setting the data in the value node seperately and if you are directly using the model node the data in this kind of node will come automatically.
It just depends on the use ase youa re having.
I hope this helps you!
Thanks and Regards
Pravesh
Hi Srini,
Please check these
1 . Should i bind the Radio button by index to Value node or directly to the model node.
A:Directly to model node inside the Output node
2 . In the code "wdContext.nodeRBNode().setLeadSelection(indexoftherecord) how to calculate the indexoftherecord?
A: index of the record,
As you are populating two values "Yes" and "No"
Your table is like this:
index code description
0--
1--
So if you want to set No,
wdContext.nodeRBNode().setLeadSelection(0);
Regards,
Siva
Hi Srini,
I think you don't have data in the node. Are you setting the leadselection for Output/RBnode? You have to use that node only.
You can avoid this exception like this
if(wdContext.nodeRBNode().size()>=indexoftherecord)
{
wdContext.nodeRBNode().setLeadSelection(indexoftherecord);
}
note: call your RFC in wdDoInit() and populate values before using this code
Regards,
Siva
Hi Srini,
try following code
wdContext.node<Node Name>().setLeadSelection(i);
where i is the attribute that you want to be defalut selected.
If you want 1st radiobutton to be default selected then use i = 0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
RadioButtonByGroup UI element ,If we supply data from SimpleType By default nothing is selected.
To make particular selection we put in wdDoInit
wdContext.currentContextElement().setTest("Yes");
But In case of populated data form BAPI(Say this is the special case )
put in wdDoInit wdContext.currentContextElement().setTest("");
will work
Note : will work for RadioButtonByGroup UI element
Best Regards
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
i hope you have provided values in the Dic-> Simple Type . in emuneration .
you provide values and text . suppose . values is 1 and text is YES
and values is 2 text is NO .
create a attribute and then bind the type as simple type .
then
wdcontext.currentcontext.set<attrName>(2); in the init() method .
you can even search in SDN , there are many posts available with similar post
murali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.