How to manage the state of Combobox

How to manage the state of Combobox

i created the webblock with the combobox and used that webblock in all the webscreen.When i change the value in combobox in webblock i get that value using Notify to the webscreen.
my problem is if combobox had 'Test1','test2' & 'test3'.Now i m in homepage.I changed the combobox from 'Test1' to 'Test2'.Now i got to some other webpage the combobox value is changed to default as 'Test1'.here i want to maintain the value as 'Test2'.

Please guide how to maintain the state of combobox

If I understood it well, you have a page with your comboBox widget, and when your comboBox widget sends you to some OtherPage, for some logic that you've built, you loose the value in the comboBox widget, that you also have in the OtherPage. And it looses the value, because, of course it's a diferente comboBox instance.

I think that the solution to your problem will really depends on what you want to do.

But here are some options:
- You can use a session variable: Where you keep the value sent by Notify, from your comboBox, and then send your Session Variable back in the widget on the OtherPage screen. (note: for this case I supose you have some inputs on your webblock that allows you to set the default value of the comboBox)
- Just hardCode it in the OtherPage: bu this really depends if the comboBox only depends on the screen that you are.
- You can also simply pass the value of the comboBox by QueryString introducing the parameter in the targetScreen where you need your comboBox value to remain the chosen.

All it depends of what & how you want to do.

Sorry if I understood wrong

If you need some other advice just tell that we'll try to figure it out ;)


José Queirós
Hi Deveraj

A web-block in a web-screen does not maintain "internal state". If you include the same web-block in two distinct web-screens, two instances of that web-block will exist. So if you have the following scenario:
  • WebBlock MyCombo with a combo-box;
  • WebScreens Screen1 and Screen2, both with the MyCombo included;
  • Link in Screen1 to Screen2
When you change the value of the combo in Screen1 and move to Screen2, the web-block is recreated from scratch - losing your selection.

A way to accomplish this is to use a Session Variable to store the value of the combo. Just map the value of the combo to the session value, and it will retain its value whatever the screen you are in.

If your logic is more complex (instead of one combo you were trying to save a user form - e.g. enrolling in your application) you should create an Entity to store the value and associate it with the current user - e.g. save the id of the Entity Record in a session variable.

Please let me know if you have any questions to this regard.