Tuesday, 4 September 2012

Redirect to tab from LOV

For this basic example, let me use it to re-direct to one of my tabs in my example application. I have Plugins, Google, Comments. Their submit values are T_PLUGINS, T_GOOGLE, T_COMMENTS respectively. Of course, this example was designed with the fact of apex set up with the tabs infrastructure and not lists - and to get to a specific tab, you submit the page with the tab name.

Normally, I would use a LOV from an SQL query, however for this basic example, let me just create a static LOV query.

Create the LOV in the shared components - you can find out more information about this in the builders guide - see: http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/bldapp_lov.htm#HTMDB25450

Specify name as PAGE_TABS and type as Static.

From here we want to set the display value as something that the user will see, and the return value as something we can use to. Se specify the display value as the tab display value, and the return value as the tab name.



Once done, on your page where you want to the redirect to take place, add a page item of type select list.





Then specify the List of Values as the name defined in the earlier step.



Now, to re-direct the tab, we'll use a dynamic action. On your page definition, right click on the item name, and specify Create Dynamic Action.



Specify a meaningful name. Leave the event as Change, Selection type as Item, and Item(s) as the select list that will re-direct when changed.

Clear the checkbox Fire on page load, and specify the action as Execute JavaScript code and then specify the code as:

apex.submit(this.triggeringElement.value)

Then create the dynamic action. Test your work and enjoy!

See: http://apex.oracle.com/pls/apex/f?p=45448:22