You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org> on 2006/02/01 19:17:05 UTC

[jira] Commented: (MYFACES-1086) HtmlCollapsiblePanel get's a javascript error when inside two form tags

    [ http://issues.apache.org/jira/browse/MYFACES-1086?page=comments#action_12364842 ] 

Martin Marinschek commented on MYFACES-1086:
--------------------------------------------

wohoo - what's that?

nested forms, that's invalid HTML, right?

I wouldn't even put two forms on a page: If you need something like partial validation or model-update, checkout MyFaces new s:subForm component, but don't use more than one form on a page.

regards,

Martin

> HtmlCollapsiblePanel get's a javascript error when inside two form tags
> -----------------------------------------------------------------------
>
>          Key: MYFACES-1086
>          URL: http://issues.apache.org/jira/browse/MYFACES-1086
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Versions: 1.1.1
>  Environment: Win 2000, Tomcat 5.5.15. Tested on both internet explorer 6.0 and Firefox 1.0
>     Reporter: Petter Hellstrom

>
> When placed inside of two form tags the HtmlCollapsiblePanel generates a javascript error when a link in the panel is clicked. 
> The error seems to come from that the javascript can't find the correct form.
> In the code below there is two form tags, one nesting the other. This code generates the error.
> Removing one of the form tags makes the page to work properly.
> <%@ page session="false" contentType="text/html;charset=utf-8"%>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
> <html>
> <!--
> /*
>  * Copyright 2004 The Apache Software Foundation.
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> //-->
> <body>
> <f:view>
>   <h:form id="form1">
>     <t:saveState value="#{firstCollapsiblePanelBean}"/>
>     <t:saveState value="#{secondCollapsiblePanelBean}"/>
>     <t:saveState value="#{thirdCollapsiblePanelBean}"/>
>     <h:form id="form2">
>         <t:collapsiblePanel id="test1" value="#{firstCollapsiblePanelBean.collapsed}" title="testTitle">
>             <h:panelGrid>
>                 <h:outputText value="#{firstCollapsiblePanelBean.firstName}"/>
>                 <h:inputText value="#{firstCollapsiblePanelBean.surName}"/>
>                 <t:inputCalendar value="#{firstCollapsiblePanelBean.birthDate}" renderAsPopup="true"/>
>             </h:panelGrid>
>         </t:collapsiblePanel>
>         <t:collapsiblePanel id="test2" value="#{secondCollapsiblePanelBean.collapsed}" title="testTitle"
>                             var="test2collapsed">
>             <f:facet name="header">
>                 <t:div style="width:500px;background-color:#CCCCCC;">
>                     <h:outputText value="Person"/>
>                     <t:headerLink immediate="true">
>                         <h:outputText value="> Details" rendered="#{test2collapsed}"/>
>                         <h:outputText value="v Overview" rendered="#{!test2collapsed}"/>
>                     </t:headerLink>
>                 </t:div>
>             </f:facet>
>             <f:facet name="closedContent">
>                 <h:panelGroup>
>                     <h:outputText value="#{secondCollapsiblePanelBean.firstName}"/>
>                     <h:outputText value=" "/>
>                     <h:outputText value="#{secondCollapsiblePanelBean.surName}"/>
>                     <h:outputText value=", born on: "/>
>                     <h:outputText value="#{secondCollapsiblePanelBean.birthDate}"/>
>                 </h:panelGroup>
>             </f:facet>
>             <h:panelGrid>
>                 <h:outputText value="#{secondCollapsiblePanelBean.firstName}"/>
>                 <h:inputText value="#{secondCollapsiblePanelBean.surName}"/>
>                 <t:inputCalendar value="#{secondCollapsiblePanelBean.birthDate}" renderAsPopup="true"/>
>             </h:panelGrid>
>         </t:collapsiblePanel>
>         <t:collapsiblePanel id="test3" value="#{thirdCollapsiblePanelBean.collapsed}" title="testTitle"
>                             var="test2collapsed">
>             <f:facet name="header">
>                 <t:div style="width:500px;background-color:#CCCCCC;">
>                     <h:outputText value="Person"/>
>                     <t:headerLink immediate="true">
>                         <h:outputText value="> Details" rendered="#{test2collapsed}"/>
>                         <h:outputText value="v Overview" rendered="#{!test2collapsed}"/>
>                     </t:headerLink>
>                 </t:div>
>             </f:facet>
>             <f:facet name="closedContent">
>                 <h:panelGroup>
>                     <h:outputText value="#{thirdCollapsiblePanelBean.firstName}"/>
>                     <h:outputText value=" "/>
>                     <h:outputText value="#{thirdCollapsiblePanelBean.surName}"/>
>                     <h:outputText value=", born on: "/>
>                     <h:outputText value="#{thirdCollapsiblePanelBean.birthDate}"/>
>                 </h:panelGroup>
>             </f:facet>
>             <h:panelGrid>
>                 <h:outputText value="#{thirdCollapsiblePanelBean.firstName}"/>
>                 <h:inputText value="#{thirdCollapsiblePanelBean.surName}"/>
>                 <t:inputCalendar value="#{thirdCollapsiblePanelBean.birthDate}" renderAsPopup="true"/>
>             </h:panelGrid>
>         </t:collapsiblePanel>
>         <t:dataTable id="test_dt" var="person" value="#{thirdCollapsiblePanelBean.persons}" preserveDataModel="false">
>             <h:column>
>                 <t:collapsiblePanel id="test4" var="test4collapsed" value="#{person.collapsed}">
>                     <f:facet name="header">
>                         <t:div style="width:500px;background-color:#CCCCCC;">
>                             <h:outputText value="Person"/>
>                             <t:headerLink immediate="true">
>                                 <h:outputText value="> Details" rendered="#{test4collapsed}"/>
>                                 <h:outputText value="v Overview" rendered="#{!test4collapsed}"/>
>                             </t:headerLink>
>                             <h:commandLink value=" test" action="#{person.test}"/>
>                         </t:div>
>                     </f:facet>
>                     <h:inputText id="firstname_input" value="#{person.firstName}"/>
>                     <h:commandLink value="test" action="#{person.test}"/>
>                 </t:collapsiblePanel>
>             </h:column>
>         </t:dataTable>
>  
>    </h:form>
> </h:form>
> </f:view>
> </body>
> </html>
> Many regards / Petter Hellstrom

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira