on 08-28-2006 12:58 PM
hi
I have created 6 radio buttons.This is my coding at wdInit() of my view:
IPrivateOrder_Entry_view1.IRadioButton1Node radiobutton = wdContext.nodeRadioButton1();
IPrivateOrder_Entry_view1.IRadioButton1Element elementRadio;
String[] check = { "Buy", "Sell", };
for (int j = 0; j < check.length; j++)
{
elementRadio = wdContext.nodeRadioButton1().createRadioButton1Element();
wdContext.nodeRadioButton1().addElement(elementRadio);
elementRadio.setBuy(check[j]);
wdContext.nodeRadioButton1().setSelected(elementRadio.index(), false);
}
IPrivateOrder_Entry_view1.IRadioButton2Node radiobutton1 = wdContext.nodeRadioButton2();
IPrivateOrder_Entry_view1.IRadioButton2Element elementRadio1;
String[] choice = { "InFlow", "OutFlow", };
for (int j = 0; j < choice.length; j++)
{
elementRadio1 = wdContext.nodeRadioButton2().createRadioButton2Element();
wdContext.nodeRadioButton2().addElement(elementRadio1);
elementRadio1.setInflow(choice[j]);
wdContext.nodeRadioButton2().setSelected(elementRadio1.index(), false);
}
IPrivateOrder_Entry_view1.IRadioButton3Node radiobutton2 = wdContext.nodeRadioButton3();
IPrivateOrder_Entry_view1.IRadioButton3Element elementRadio2;
String[] select = { "Capital", "Revenue" };
for (int j = 0; j < select.length; j++)
{
elementRadio2 = wdContext.nodeRadioButton3().createRadioButton3Element();
wdContext.nodeRadioButton3().addElement(elementRadio2);
elementRadio2.setCapital(select[j]);
wdContext.nodeRadioButton3().setSelected(elementRadio2.index(), false);
}
I have a drop down with export and import values .
I want that if user chooses radio button sell then,value export is selected in drop down and radio button outflow is selected or if buy is selected the value import is selected and radio button inflow is selected.This all should happen on my Action of Validation Button
Regards
Nidhideep
Message was edited by: Armin Reichert
Changed i to j to avoid formatting as italics
Assuming you have bound RadioButtonGroupByIndex elements to nodes RadioButton1,...
<i>I want that if user chooses radio button sell then,value export is selected in drop down and radio button outflow is selected</i>
Create an action "SellOptionsSelected" and assign it to the "onSelect" event of the radio button group.
In the action handler, write
void onSellOptionsSelected(...)
{
/* you could also use index instead of attribute value */
String selection = wdContext.currentRadioButton1Element().getBuy();
if ("Sell".equals(selection))
{
/* set selection of drop-down node */
wdContext.node<your-node-here>().setLeadSelection(<index-for-export>);
/* select radio button "OutFlow" (index = 1) */
wdContext.nodeRadioButton2().setLeadSelection(1);
}
}
Armin
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 made three RadioButtonGroupByKey and bound its element each to RadioButton1 ,RadioButton2,RadioButton3.
My context has a value node order_entry under which i have valueNodes RadioButton1(attribute buy),value node RadioButton2(Attribute inflow),RadioButton3(attribute capital).And then i have done coding i explained earlier in my postings.I have a dropdownbykey with 4 values {Export,import,receipt,payment).Armin your code is not working and Sridhar i am clear with ur idea,especially regarding wht is DDVAL?
Please help me
Regards
Nidhideep
hi
Sridhar i am providing you with matrix of my logic
Buy/sell inflow/outflow Cash/Revenue
Exports sell Inflow Revenue
Import Buy outflow Revenue/cash
Payment Buy outflow Revenue/cash
Receipt sell Inflow Revenue
It means if click on my validate button:
First case:
Then whtever the user selected but if he has selected Exports (dropdown)then radio button sell is selected (which is in RadioGroup1),inflow is selected(from RadioGroup2,Revenue is selected (from RadioGroup3).
Regards
Nidhideep
Hi,
<b>First Case</b>
If the user Selects Exports from DropDown, then RadioButton1 value has to be selected.
For this,
Create a SimpleType with Enum val as Export(Value) Export(txt) and assigned this to context value(dropDownVal) which is bind to dropdown.
In the "onActiondropDownSelected" - Action which is bind to DropDown - onSelect Property.
String selectedVal = context.getDropDownVal();
if(selectedVal != null || selectedVal.equalsIgnoreCase("")){
if(selectedVal.equalsIgnoreCase("Exports")){
wdContext.nodeRadioButton1().currentRadioButton1Element().setBuy(selectedVal);
}
}
In the same way you do for other drop down values. by Adding else conditions.
Regards,
Sridhar
Regards,
Sridhar
hi
Sridhar
I have made a simple type Export in my Enum with Val Ex,
And then bind it to dropdown and onselect event i have bind Action selectdropdown:
The coding that i ahve done in action is:
String selectedVal = wdContext.currentDropDownElement().getType();
if(selectedVal != null || selectedVal.equalsIgnoreCase("")){
if(selectedVal.equalsIgnoreCase("EXPORT")){
wdContext.nodeRadioButton1().currentRadioButton1Element().setBuy("Buy");
}
}
But result is not coming.
Regards
Nidhideep
Hi,
Can you please check, what this selectedVal is giving output by using MessageManager.
String selectedVal = wdContext.currentDropDownElement().getType();
//testing purpose
manager.reportSuccess("selectedVal "+selectedVal);
if(selectedVal != null || selectedVal.equalsIgnoreCase("")){
if(selectedVal.equalsIgnoreCase("EXPORT")){
wdContext.nodeRadioButton1().currentRadioButton1Element().setBuy("Buy");
//testing purpose
manager.reportSuccess("Came Here");
}
}
I doubt on your "setBuy("Buy");" Make it as "setBuy("buy");.
Check with your RadioButton1.buy - simple type. You might have declared it as 'buy'.
Regards,
Sridhar
Still confused about your posts.
What kind of RadioButtonGroup are you using, *ByIndex or *ByKey?
If you are using *ByIndex and you want to select the radio button at index <i>idx </i>(index counting starts with 0), then you have to use code like
String selectedVal = wdContext.currentDropDownElement().getType();
if ("EXPORT".equals(selectedVal))
{
wdContext.nodeRadioButton1().setLeadSelection(idx);
}
Armin
hi
Armin and Sridhar i have solved my problem.Thanx for so much support.But i want some more enhancement.I am showing you my code:
public void onActiondropdownselected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActiondropdownselected(ServerEvent)
String selectedVal = wdContext.currentDropDownElement().getType();
if(selectedVal != null || selectedVal.equalsIgnoreCase("")){
if(selectedVal.equalsIgnoreCase("EXPORT")){
****/for my selection of my buy radio button **/
wdContext.nodeRadioButton1().setLeadSelection(1);
****/for my selection of my inflow radio button **/
wdContext.nodeRadioButton2().setLeadSelection(0);
****/for my selection of my Cash radio button **/
wdContext.nodeRadioButton3().setLeadSelection(1);
}
I want that when Export is selected sell Radio Button is selected and Buy Radio Button is grayed out or not visible.Buy and sell belongs to same RadioButton group by index(Armin i am sorry to confuse you).Ans same for other cases.
Please help me
Regards
Nidhideep
Hi
in your code your condition not matches the "" check.
try this
if(selectedVal != null && !selectedVal.equalsIgnoreCase("")){
if(selectedVal.equalsIgnoreCase("EXPORT")){
****/for my selection of my buy radio button **/
wdContext.nodeRadioButton1().setLeadSelection(1);
****/for my selection of my inflow radio button **/
wdContext.nodeRadioButton2().setLeadSelection(0);
****/for my selection of my Cash radio button **/
wdContext.nodeRadioButton3().setLeadSelection(1);
}
Kind Regards
Mukesh
Hi Nidhideep,
Check your condition like this.
if(selectedVal != null || !(selectedVal.equalsIgnoreCase(""))){
}
If you do not want to show(invisible) the any control, then create a context variable(visibleVar) with type as
com.sap.ide.webdynpro.uielementdefinitions.Visibility and assign this variable to control visible property.
context.setVisibleVar(WDVisibility.BLANK);
//To make visible context.setVisible(WDVisibility.VISIBLE);
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nidhideep,
If I Understood you requirement correctly, you want to show corresponding radio button value in the Drop Down and vice versa. If Sell is selected in RadioButton Export should appear on DropDown.
Follow the below steps.
Create simple type with values Sell(val) - Export(Txt) , Buy-Import and assign this to DropDownByKey.
Create two Actions RadioButtonSelected , DropDownSelected.
Assing RadioButtonSelected Action to RadioButtonGroupByKey - OnSelect Property.
//on the Action Method paste this code
IWDNodeInfo nodeInfo = wdContext.getNodeInfo();
IWDAttributeInfo attrInfo = nodeInfo.getAttribute(context.DDVAL);
//DDVal is the simple type assigned to DropDown
IModifiableSimpleValueSet valueSet = attrInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
String first = null;
if(valueSet != null){
first = (String)valueSet.getText(context.getFirstradion().trim());
//context.getFirstradion - radion button assigned context val
}
context.setDdval(first);
//assigns first (Import / Export) to Drop Down.
Assing DropDownSelected Selected Action to Drop Down On Select.
String selectedVal = context.getDdval();
//Assing Selected DropDown val to Radio Group by Key
context.setFirstradion(selectedVal);
I have done for only Buy and Sell.
Reply me back, if you want any clarifications.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.