on 01-03-2008 11:50 AM
hi,
i have two radio buttons.i need to pass some parameters so to inform as to which radio button is selected.Plz tell the code and way to display this.its liitle urgent
Hi,
You need add radioButtonGroupByKey to your view. Add a context attribute.
Create a simple type with two values:
Value: Description:
Y YES
N NO
Select this simple type as the type of your attribute.
Now map this attibute to the selectedKey property of your radioButtonGroupByKey. Now if YES is selected then the value of the attribute will be Y and for NO it will be N.
You can get the information about which radio button is selected using this attribute.
Hope this will solve your problem.
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nisha,
First few information for radio button elemnt.
(1)The RadioButton UI element represents a two-state button.
(2)The property selectedKey must be bound to a context attribute, e.g. Key. The radio button is selected if the value of attribute Key equals the value of the property keyToSelect.
(3)On selection of the radio button, the action assigned to event onSelect is executed.
Now as I said above insert two radio buttons. And create one context attribute of string type "selectedKey", and bind it with both the radio button's selected key property.
and assign following names in the radio buttons keyToSelect properties
(a) radio1 (for 1st radio button)
(b) radio2 (for 2nd radio button)
And Go to properties of the radio button and create an action for onSelect for the radio button.
And for second radio button , assign the same onSelect action.
Now when you select any of the radio button, then do following operation in onSelect method.
String selectedKey=wdContext.currentContextElement().getSelectedKey();
if(selectedKey.equals("radio1")){
//do the needed operation
} if(selectedKey.equals("radio2")){
}
Feel free to ask questions
REgards,
Praveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
i have writtne this code in onactionSelect action
String selectedKey=wdContext.currentContextElement().getVa_selectedkey();
if(wdContext.currentContextElement().getVa_selectedkey()=="KEY_0")
{
wdContext.currentVn_radioElement().setVa_formal(true);
//wdContext.currentVn_radioElement().setVa_streamline(false);
}
else
if(wdContext.currentContextElement().getVa_selectedkey()=="KEY_1")
{
//wdContext.currentVn_radioElement().setVa_formal(false);
wdContext.currentVn_radioElement().setVa_streamline(true);
}
where va_streamline and va_normal are set enabled property of each radio buttons.
and KEY_0and KEY_1 are are setto key to select property.
but the problem is at the run time radio buttons are getting disabled.what should be donee.plz helppp
Hi,
Add a parameter to the onSelect action of the radio button.
map this parameter to the id of the radio buttons.
Ex:
In your WdModify
IWDRadioButton rb1 = (IWDRadioButton)view.getElement("<Your Radio Button1>");
IWDRadioButton rb2 = (IWDRadioButton)view.getElement("<Your Radio Button2>");
rb1.mappingOfOnSelect().addSourceMapping("selected", "ID");
rb2.mappingOfOnSelect().addSourceMapping("selected", "ID");
parameter selected should be of type string.
In the action handler write the corresponding code
if(selected.equals("Male")) // if the ID is Male
// Your code
else
// Your code
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a generic onSelect event handler for both the radio buttons with a parameter of type string
Map this parameter to the ID of individual radio buttons.
When the radio button is selected this event will be called with different IDs.
Based on the ids you can perform different actions.
Regards
Ayyapparaj
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.