cancel
Showing results for 
Search instead for 
Did you mean: 

radio button values getting cached in view naviagation

Former Member
0 Kudos

Hi Experts.

I have two views in my applications..

In the first view there is a set of radio buttons which are gouped by key.

with two options debit and credit card. (Type of card is defined as a dictionary type)

on next from first view if credit card is selected it works fine.

but if i try to come back to the view previous view and click the other option second time.

The value of card type is not changed. IT still takes the value which is selected first.

It looks like its gettign cached .

Is there any any way I can refresh the variable value on next button click from first view

Thanks,

James

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

James,

use the wdDoInit() method of the first View to do the following,


wdContext.node<YourNode>().setLeadselection(-1);

This way u will find selection cleared for the radio button whenever your view is displayed.

Regards

Deepak

Former Member
0 Kudos

Thanks guys, I will try them and let you know

Former Member
0 Kudos

Hi,

When you switch back try to set the leadselection to -1 for the node bound to the radio button group.

wdContext.node<YourNode>().setLeadselection(-1);

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

I am not carrying the selected value in the next view. So, how cna i select the current context element of the view to no selection. Here in my application one debit card is slected the values is in controller context and not in second view. It executes a bapi ans output theresults in second view.

I tried as you suggested it didnt work.

Thanks,

James

Former Member
0 Kudos

Hi James,

Try making these changes.

1. Open your View and go to its Properties tab.

2. Change the lifespan value to when visible.

Regards,

Murtuza.

Former Member
0 Kudos

Hi Ayyapa,

I am not store the values under any node in the context.

the values are in controller context directly as attributes.

context

debit

credit.

and etc.

so, settign the lead selection would not work as node. is there any other way i can do it?

your help is highly appreciated.

Thanks,

James

nikhil_bose
Active Contributor
0 Kudos

You can change it in the View properties:

Life span as when_visible

or use

wdContext.setLeadSelection(-1);

regards,

nikhil

Former Member
0 Kudos

Hi Bos,

I tired finding where to set the life span property for a view. But, I could not find where to set. Can you please hint on the navigation

former_member197348
Active Contributor
0 Kudos

Hi James,

Open the view -> Go to Properties (first) tab -> Under View properties -> Lifespan property with drop down -> In the drop down select when_ visible. But I don't think it does not suit your requirement if you are storing values in Component Controller's context.

regards,

Siva

Former Member
0 Kudos

Hi ,

When u switch back to your first View ... for outbound Plug a method will be created set to NO_Selection

in that method... this method will be executed when ever you switch back to view1 from view2.

public void onPlug<plugname>

{

//lead select to NO_Selection

wdContext.node<name>().setLeadSelection(wdContext.node<name>().NO_SELECTION);

}

Thanks,

Sunitha Hari

Former Member
0 Kudos

Hi Deepak and Hari,

I got you guys. But under my context, I dont have any node.. All I have is values attributes. When I Set lead selection to no selection or -1. Then it would the cardinality vlaue would not let it do.

In my context, element are in the following struchure

Context (parent)

CardType(child)

verifciation(child)

Former Member
0 Kudos

Her ein my second view init() module

I have

if (wdContext.currentContextElement().getfinancetype().equals("1Pos"))

wdContext.currentContextElement().setCARDVisible(WDVisibility.NONE);

else

if(wdContext.currentContextElement().getFinanceType().equals("2Pos"))

wdContext.currentContextElement().setCARDVisible(WDVisibility.VISIBLE);

This works ifne when I hit next on the first for the first time.

But when I go back from second view and change financetype option on the first view.

Later If I navigate to the second view. I would see the value in context is changed. But, the above given code is not executed. As far as I understand. Every time plug is fired the target view init() statement needs to be executed. But its not happening here.

Can any one let me know how the if I have explicitly call the init() or what to do?

former_member197348
Active Contributor
0 Kudos

Hi James,

The hook method wdDoInit() i.e. only first time is executed only once in view's life time. If you want to execute the the code whenever you navigate ti the second view, You have to keep this code in onPlugfromXXX() method. Even you can call your init() method in onPlugfromXXX() method but I don't think this is a proper way.

regards,

Siva

former_member197348
Active Contributor
0 Kudos

Hi James,

You can set radiobutton to default value like this:

wdContext.currentContextElement().set<Attribute>("any default value");

If you want to set it empty

wdContext.node<name>().setLeadSelection(wdContext.node<name>().NO_SELECTION);

It is better to have this part of code when you are navigating back to this view i.e. onPlugFromview2() method;

regards,

Siva