You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Fan Shao <ra...@yahoo.com> on 2007/08/15 18:30:04 UTC

Can I put forms within the tabbedPane component?

Hi all,

I came across a problem with tabbedPane with nested forms. I have a
tabbedPane containg 4 panelTabs. Each of the tabs has their own forms for
submission. When I load the page I got a Javascript error. When I traced
into the error I found it was possibly caused by nested forms, because the
tabbedPane generates a form by itself, within which I put other 4 forms.

My code is pretty much like this:

               <t:panelTabbedPane serverSideTabSwitch="true">
                    <t:panelTab id="tab01" label="TabA">
                        <f:subview id="indexView">
                            <h:form>
                                Name:<t:inputText value="#{bean.name}"/>
                                Address:<t:inputText
value="#{bean.address}"/>                                
                                <h:commandButton action="#{bean.save}"/>
                            </h:form>
                        </f:subview>
                    </t:panelTab>
                    <t:panelTab id="tab02" label="TabB">
                        <f:subview id="indexView2">
                            <h:form>
                                Card number:<t:inputText
value="#{bean.cardNumber}"/>
                                Expiry date:<t:inputText
value="#{bean.expiryDate}"/>                                
                                <h:commandButton action="#{bean.save}"/>
                            </h:form>
                        </f:subview>
                    </t:panelTab>                             
                </t:panelTabbedPane>   

It was rendered properly without the JS error if I took out the
commandButtons (of cause I couldn't submit the form without the buttons).

Does this mean the tabbedPane component doesn't allow forms within it? It
would be a defect if this is true. Is there anyway that I can put forms
within tabbedPane?

Thanks very much!

Fan
-- 
View this message in context: http://www.nabble.com/Can-I-put-forms-within-the-tabbedPane-component--tf4274172.html#a12165435
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Can I put forms within the tabbedPane component?

Posted by Fan Shao <ra...@yahoo.com>.
Thank u, the "subForm" component in the sandbox solved this problem well. I
really took me quite a well to find the download of the sandbox. I put the
link below in case someone needs it:

http://people.apache.org/builds/myfaces/nightly/

thanks again!



Andrew Robinson-5 wrote:
> 
> I think the panel tabbed pane requires a form outside of it.
> 
> Try using the subform sandbox component.
> 
> <h:form>
> <s:subForm>
>   <t:panelTabbedPane serverSideTabSwitch="true">
>     <t:panelTab id="tab01" label="TabA">
>        <s:subForm>
>          Name:<t:inputText value="#{bean.name}"/>
>          Address:<t:inputText value="#{bean.address}"/>
>          <h:commandButton action="#{bean.save}"/>
>        </s:subForm>
>     </t:panelTab>
>   </t:panelTabbedPane
> </s:subForm>
> </h:form>
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-I-put-forms-within-the-tabbedPane-component--tf4274172.html#a12166187
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Can I put forms within the tabbedPane component?

Posted by Andrew Robinson <an...@gmail.com>.
You cannot nest HTML forms, so if tabbedPane generates a form around
itself, then you cannot put forms inside of it.

On 8/15/07, Fan Shao <ra...@yahoo.com> wrote:
>
> The tabbedPane generates a form around itself if I don't explicitly put a
> <h:form> outside it. So it's the same effect as putting a <h:form> outside
> it.
>
> I'll try the subForm, thanks a lot!
>
>
>
> Andrew Robinson-5 wrote:
> >
> > I think the panel tabbed pane requires a form outside of it.
> >
> > Try using the subform sandbox component.
> >
> > <h:form>
> > <s:subForm>
> >   <t:panelTabbedPane serverSideTabSwitch="true">
> >     <t:panelTab id="tab01" label="TabA">
> >        <s:subForm>
> >          Name:<t:inputText value="#{bean.name}"/>
> >          Address:<t:inputText value="#{bean.address}"/>
> >          <h:commandButton action="#{bean.save}"/>
> >        </s:subForm>
> >     </t:panelTab>
> >   </t:panelTabbedPane
> > </s:subForm>
> > </h:form>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Can-I-put-forms-within-the-tabbedPane-component--tf4274172.html#a12165634
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Can I put forms within the tabbedPane component?

Posted by Fan Shao <ra...@yahoo.com>.
The tabbedPane generates a form around itself if I don't explicitly put a
<h:form> outside it. So it's the same effect as putting a <h:form> outside
it.

I'll try the subForm, thanks a lot!



Andrew Robinson-5 wrote:
> 
> I think the panel tabbed pane requires a form outside of it.
> 
> Try using the subform sandbox component.
> 
> <h:form>
> <s:subForm>
>   <t:panelTabbedPane serverSideTabSwitch="true">
>     <t:panelTab id="tab01" label="TabA">
>        <s:subForm>
>          Name:<t:inputText value="#{bean.name}"/>
>          Address:<t:inputText value="#{bean.address}"/>
>          <h:commandButton action="#{bean.save}"/>
>        </s:subForm>
>     </t:panelTab>
>   </t:panelTabbedPane
> </s:subForm>
> </h:form>
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-I-put-forms-within-the-tabbedPane-component--tf4274172.html#a12165634
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Can I put forms within the tabbedPane component?

Posted by Andrew Robinson <an...@gmail.com>.
I think the panel tabbed pane requires a form outside of it.

Try using the subform sandbox component.

<h:form>
<s:subForm>
  <t:panelTabbedPane serverSideTabSwitch="true">
    <t:panelTab id="tab01" label="TabA">
       <s:subForm>
         Name:<t:inputText value="#{bean.name}"/>
         Address:<t:inputText value="#{bean.address}"/>
         <h:commandButton action="#{bean.save}"/>
       </s:subForm>
    </t:panelTab>
  </t:panelTabbedPane
</s:subForm>
</h:form>




On 8/15/07, Fan Shao <ra...@yahoo.com> wrote:
>
> Hi all,
>
> I came across a problem with tabbedPane with nested forms. I have a
> tabbedPane containg 4 panelTabs. Each of the tabs has their own forms for
> submission. When I load the page I got a Javascript error. When I traced
> into the error I found it was possibly caused by nested forms, because the
> tabbedPane generates a form by itself, within which I put other 4 forms.
>
> My code is pretty much like this:
>
>                <t:panelTabbedPane serverSideTabSwitch="true">
>                     <t:panelTab id="tab01" label="TabA">
>                         <f:subview id="indexView">
>                             <h:form>
>                                 Name:<t:inputText value="#{bean.name}"/>
>                                 Address:<t:inputText
> value="#{bean.address}"/>
>                                 <h:commandButton action="#{bean.save}"/>
>                             </h:form>
>                         </f:subview>
>                     </t:panelTab>
>                     <t:panelTab id="tab02" label="TabB">
>                         <f:subview id="indexView2">
>                             <h:form>
>                                 Card number:<t:inputText
> value="#{bean.cardNumber}"/>
>                                 Expiry date:<t:inputText
> value="#{bean.expiryDate}"/>
>                                 <h:commandButton action="#{bean.save}"/>
>                             </h:form>
>                         </f:subview>
>                     </t:panelTab>
>                 </t:panelTabbedPane>
>
> It was rendered properly without the JS error if I took out the
> commandButtons (of cause I couldn't submit the form without the buttons).
>
> Does this mean the tabbedPane component doesn't allow forms within it? It
> would be a defect if this is true. Is there anyway that I can put forms
> within tabbedPane?
>
> Thanks very much!
>
> Fan
> --
> View this message in context: http://www.nabble.com/Can-I-put-forms-within-the-tabbedPane-component--tf4274172.html#a12165435
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>