Restore panel in odc:tabbedPanel

Hi,

I posted on this issue before and received a reply from BalusC to follow

http://balusc.xs4all.nl/srv/dev-jep-tab.html.

Using that info, what I have done is put hidden variables in each of the forms named hiddenText1 and hiddenText2. So when the form submits, the hidden variables will not be null. Keeping this in view in my bean I saidpublicboolean isForm1Submitted(){

if(getHiddenText2() !=null)

returntrue;

else

returnfalse;

}

and the same for form2Submitted respectively. And in the jsp page for the script, I put in the foll. code. But still doesn;t restore my panel when panel2 is submitted. MAy I know what am I doing wrong here ... I would appreciate any kind of help on this. <f:verbatim>

<script>

panel = ODCRegistry.getClientControl('tabbedPanel1');

if (document.getElementById('form1:hiddenText1') == </f:verbatim><h:outputText value="#{pc_PowerSelectView.form1Submitted}"/><f:verbatim>){

panel.restoreUIState('bfpanel1');

}elseif (document.getElementById('form1:hiddenText2') == </f:verbatim><h:outputText value="#{pc_PowerSelectView.form2Submitted}"/><f:verbatim>){

panel.restoreUIState('bfpanel2');

}

</script>

</f:verbatim>

Thanks a lot before hand

[2102 byte] By [slata] at [2007-10-3 2:01:09]
# 1
Sorry I shouldn;t have kept the foll text in there. I was trying something elsedocument.getElementById('form1:hiddenText1') Without this would be code
slata at 2007-7-14 18:59:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

if (</f:verbatim><h:outputText value="#{pc_PowerSelectView.form1Submitted}"/><f:verbatim>) {

panel.restoreUIState('bfpanel1');

} else if (</f:verbatim><h:outputText value="#{pc_PowerSelectView.form2Submitted}"/><f:verbatim>) {

panel.restoreUIState('bfpanel2');

}

How does this look like in the HTML source?

BalusCa at 2007-7-14 18:59:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hi BalusC,

The HTML Source is

panel = ODCRegistry.getClientControl('tabbedPanel1');

if (true) {

panel.restoreUIState('bfpanel1');

} else if (true) {

panel.restoreUIState('bfpanel2');

}

One question why are they both true? I initialized the variables form1Submitted and form2Submitted to false in the bean. Only if the form is submitted they are supposed to be set to true... right

Second question is when the form2 is submitted, the hiddenText2 is null. It's not catching it... I put the hidden variables in the foll. way

<odc:bfPanel id="bfpanel1" name="PowerSelect Table Layouts"

showFinishCancelButton="false">

<h:form styleClass="form" id="form1">

<h:inputHidden id="hiddenText1" value="Yes"></h:inputHidden>

.....

</h:form>

<odc:bfPanel id="bfpanel2" name="Vision SQL"

showFinishCancelButton="false">

<h:form id="form2">

<h:inputHidden id="hiddenText2" value="Yes"></h:inputHidden>

...

</h:form>

slata at 2007-7-14 18:59:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Better way is to use just the action method of the backing bean to set which form was submitted.

Exampleprivate int submittedForm;

public void submitForm1() {

// do your submit thing

submittedForm = 1;

}

public boolean isForm1Submitted() {

return submittedForm == 1;

}

BalusCa at 2007-7-14 18:59:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Even this doesn't work. Now the html source is correct

<script>

panel = ODCRegistry.getClientControl('tabbedPanel1');

if (false) {

panel.restoreUIState('bfpanel1');

} else if (false) {

panel.restoreUIState('bfpanel2');

}

</script>

It sets to true when the respective forms get submitted now. (i.e. when I use your return submittedForm == 1 and return submittedForm == 2) But..... it comes back to the first Panel when the second form form is submitted too

Is it a RAD issue here.... I have upgraded to 6.0.1.1 as somewhere I read in the forums that this would solve the matter but it didn't...

Please let me know the solution. I am nearing the deadlines and struggling on this...

Thanks a lot

slata at 2007-7-14 18:59:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

This hack is WSAD 5.x specific. As I don't have RAD 6.x running here, I cannot confirm whether this would work.

All I have done is [url=https://addons.mozilla.org/firefox/216/]debugging[/url] and hacking the heap of unreadable and undocumented Javascripts used by ODC components to find out how the panel could be restored.

BalusCa at 2007-7-14 18:59:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
I have tried this application on Internet Explorer browser also... It is the same case. So it may not be the RAD issue either..
slata at 2007-7-14 18:59:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...