Retaining Selection of JSF Tabbed Panels

I have the following function which is supposed to display my SECOND tab panel on body load of the page:

function setPane1()

{

panel = ODCRegistry.getElementById('tabbedPanel1','1');

panel.restoreUIState('bfpanel2');

}

<BODY onload="setPane1();">

My tab panels are something liek this:

<odc:tabbedPanel id="tabbedPanel1" width="100%"

slantActiveRight="4" styleClass="tabbedPanel" showTabs="true"

slantInactiveRight="4" variableTabLength="false"

showBackNextButton="false" height="100%" >

<odc:bfPanel id="bfpanel1" name="My First Tab Panel"

showFinishCancelButton="false" >

//content of tabpanel 1

</odc:bfPanel>

<odc:bfPanel id="bfpanel2" name="My Second Tab Panel"

showFinishCancelButton="false">

//Content of tabpanel2

</odc:bfPanel>

</odc:bfPanel>

<f:facet name="back">

<hx:commandExButton type="submit" value="&lt; Back"

id="tabbedPanel1_back" style="display:none"></hx:commandExButton>

</f:facet>

<f:facet name="next">

<hx:commandExButton type="submit" value="Next &gt;"

id="tabbedPanel1_next" style="display:none"></hx:commandExButton>

</f:facet>

<f:facet name="finish">

<hx:commandExButton type="submit" value="Finish"

id="tabbedPanel1_finish" style="display:none"></hx:commandExButton>

</f:facet>

<f:facet name="cancel">

<hx:commandExButton type="submit" value="Cancel"

id="tabbedPanel1_cancel" style="display:none"></hx:commandExButton>

</f:facet>

</odc:tabbedPanel>

However, the function to display the 2nd tab panel by default on body load is not working at all, and the first panel is displaying as usual.

Could someone please help?

Thanks in advance! :-)

[3075 byte] By [incognita@a] at [2007-11-26 15:29:58]
# 1

Put it at the end of the body instead of in body onload. Just follow the example in http://balusc.xs4all.nl/srv/dev-jep-tab.html

If you want to use a separate function, then put the call at the end of the body, after the hx:scriptcollector:

<html>

<body>

<hx:scriptcollector>

<odc:tabbedPanel>

...

</odc:tabbedPanel>

</hx:scriptcollector>

<f:verbatim><script>setPane1();</script></f:verbatim>

</body>

</html>

This is because the tabbedpanel isn't finished yet with rendering while the body onload is called. The ODC javascripts collected by hx:scriptcollector will be executed after the body onload and finally the javascript after the hx:scriptcollector will be executed.

BalusCa at 2007-7-8 21:46:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi BalusC..

Thanks for the reply.. I'd checked your site before too for the same issue..

I did exactly as you said, ie, placing that script after the scriptcollector, and before the </body> tags, but it still makes no difference.

I'm using IBM Websphere 5.1.2. Would this make any difference?

Thanks in advance. :)

incognita@a at 2007-7-8 21:46:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Try to use ODCRegistry.getClientControl('tabbedPanel1'); instead of getElemenyById('tabbedPanel1', '1').
BalusCa at 2007-7-8 21:46:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I did that too..Any other suggestions you got? Thanks in advance :)
incognita@a at 2007-7-8 21:46:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
I shouldn't know other solutions. I suggest you to download and install [url= http://www.google.com/search?q=venkman+javascript+debugger]Venkman Javascript Debugger[/url] and debug the Javscript. I had done the same to find out this one trick to swtich the tabs manually.
BalusCa at 2007-7-8 21:46:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...