cancel
Showing results for 
Search instead for 
Did you mean: 

Hide Radi Button

Former Member
0 Kudos

Hi Friends,

I have a requirement where i have to hide or show radio buttons based on employee SUBTYPE , say example i have three radio buttons like 1. Savings 2. Checking 3. Fixed

Here the Scenario:

String Value = wdContext.currentSubtypesElement().getSubtype();

if (Value = 9U01)

{

I have to show 2 Radio buttons (1. Savings 2. Checking )

}

else{

I ahve to show 3 Radio button that is ( 1. Savings 2. Checking 3.Fixed)

}

To achieve the above functionality i am doing this;

After implementing below give code , if i click on Subtype 01 for Main Bank it is showing 3 Radio buttons as i expected but if i come back and select Subtype 9U01 for Fixed it is till showing 3 Radio Butons where as it should show 2 Radio Buttons.

some how theo Subtype value is not getting refresh when i come back from Detail screen to Overview screen, please help.


	String Value = wdContext.currentSubtypesElement().getSubtype();
	
	if (!Value.equals("9U01") && Value.equals("0") || Value.equals("2") )
	{
	
		Collection coll = new ArrayList();
		IPrivateDetailView.IAccount_type_radiobuttonElement elementRadio0 = wdContext.createAccount_type_radiobuttonElement();
		IPrivateDetailView.IAccount_type_radiobuttonElement elementRadio1 = wdContext.createAccount_type_radiobuttonElement();
		IPrivateDetailView.IAccount_type_radiobuttonElement elementRadio2 = wdContext.createAccount_type_radiobuttonElement();
		elementRadio0.setText(wdThis.wdGetAPI().getComponent().getTextAccessor().getText("Savings"));
		elementRadio0.setValue("01");
		coll.add(elementRadio0);
		elementRadio1.setText(wdThis.wdGetAPI().getComponent().getTextAccessor().getText("Checking"));
		elementRadio1.setValue("02");
		coll.add(elementRadio1);
		elementRadio2.setText("None");

			elementRadio2.setText("Fixed"); 
			elementRadio2.setValue("");
			coll.add(elementRadio2);

		node.bind(coll);
	
	}
else
	{
		Collection coll = new ArrayList();
		IPrivateDetailView.IAccount_type_radiobuttonElement elementRadio0 = wdContext.createAccount_type_radiobuttonElement();
		IPrivateDetailView.IAccount_type_radiobuttonElement elementRadio1 = wdContext.createAccount_type_radiobuttonElement();
		
		elementRadio0.setText(wdThis.wdGetAPI().getComponent().getTextAccessor().getText("Savings"));
		elementRadio0.setValue("01");
		coll.add(elementRadio0);
		elementRadio1.setText(wdThis.wdGetAPI().getComponent().getTextAccessor().getText("Checking"));
		elementRadio1.setValue("02");
		coll.add(elementRadio1);
		node.bind(coll);
		
	}

Thanks

Advance

Edited by: peter Mark on Mar 16, 2009 4:03 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Peter,

I would recommend you to create all the 3 radio buttons at design time.

Now at runtime depending on the value of employee sub-type, set the property 'visible' of the radio button to 'none' (this makes it invisible with no space taken).

You can also refer pdf (page 51) https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0e682bd-b59e-2b10-cd82-fa175f50...

Hope this helps you.

Kind Regards,

Nitin

Edited by: Nitin Jain on Mar 16, 2009 4:09 PM

Former Member
0 Kudos

Nithin,

I Appreciate your quick reply, please can you give detialed steps how to achieve this?

I created IWDRadiaoButtobDropDownByIndex , how do i get specific value key to hide specific account type based on selected subtype, so that i can write this under wdModify to hide the RadoButton account type based on selected Subtype.

Thanks in Acvance

Peter

former_member201361
Active Contributor
0 Kudos

Hi Peter,

to which UI element the Subtype attribute is bound ? for eg : if the subtype represents a drop down , then create a action say "on select" & bound this action to the onSelect proiperty of Drop down and in this action method ,get the subtype value and perform the Validation ie whether to show two radio buttons or three radio buttons...

Thanks and Regards

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

Thanks for all. This issue is resloved. I used only if condition where it is not 9U01, remove the radio button and it works fine. The system only check the condition is it equals 9U01 or not.

Thanks to all for the input and i appricate your help.

Peter

vmadhuvarshi_
Contributor
0 Kudos

Peter,

Usually it is good to define your UI elements at design time and control their visibility at run time. However, I believe you are working in ESS banking area here and might want to use the existing functionality.

So far, I'm not certain about the behavior of Radio buttons but I noticed couple of things in your code.

If value for subtype 9U01 equals "9U01", should this not be "01" for Subtype 01?

If this is true then you are not checking for this value here

if (!Value.equals("9U01") && Value.equals("0") || Value.equals("2") )

If that case, there is something amiss with above condition as this is true all the time.

Please let me know if I misunderstood something here.

Regards,

Vishwas.

Former Member
0 Kudos

String subType = wdContext.currentSubtypesElement().getSubtype();

if ( !"9U01".equals(subType) || ( "0".equals(subType) || "2".equals(subType) ) ) {
// Code..
}

The behaviour of the above Code would be:

Display whatever when:

- Anytime SubType is different from 9U01 OR;

- SubType is equal to 0 or 2;


String subType = wdContext.currentSubtypesElement().getSubtype();

if ( !"9U01".equals(subType) && ( "0".equals(subType) || "2".equals(subType) ) ) {
// Code..
}

Display whatever when:

- Anytime SubType is different from 9U01 AND;

- SubType is equal to 0 or 2;

I hope it helps.

Regards,

Daniel

Former Member
0 Kudos

You could do this:

At design-time, create 3 individual radio buttons "savingsRB", "checkingRB" and "fixedRB". Assign texts using the View Designer (no need to use text accessor API etc.), bind "selectedKey" properties to a common context attribute, set "keyToSelect" properties as needed.

Bind "visible" property of "fixedRB" to a calculated context attribute "fixedRBVisibility" of dictionary type "Visibility" and implement calculated attribute as


WDVisibility getFixedRBVisibility(IContextElement element)
{
  return "9U01".equals( wdContext.currentSubtypesElement().getSubtype() )
    ? WDVisibility.NONE
    : WDVisibility.VISIBLE
}

This hides the "fixedRB" buttons if the subtype has the given value.

Armin