Hi,

 

I cannot use a single form for my document because I have yet another form nested in-between the two forms. Please see the illustration below:

 
<f:view>
<h:form id="parent_form1">
 
<h:inputText id="name" value="#{backingBean.var1}"/>
 
</h:form>
 
 
<h:form id="child_form">
 
<h:inputText id="child_component" value="#{childBean.var1}"/>
 
<h:commandButton value="ADD" action=""/>
 
</h:form>
 
 
<h:form id="parent_form2">
 
<h:inputText id="address" value="#{backingBean.var2}"/>
 
<h:commandButton value="SAVE" action=""/>
 
</h:form>
</f:view>
 
The child form is independent of the two parent forms and is the child section has to be nested in-between the parent forms due to user-requirement.  The save button has to save all the parent components. You have any more idea on this?
 

From: "Mike Kienenberger" <[EMAIL PROTECTED]>
Reply-To: "MyFaces Discussion" <[email protected]>
To: "MyFaces Discussion" <[email protected]>
Subject: Re: How to submit multiple forms
Date: Thu, 10 Aug 2006 10:42:46 -0400
>On 8/10/06, Mak Nern Fatt Melvin <[EMAIL PROTECTED]> wrote:
>>I want to save the data in both the two forms when i clicked the
>>save button
>>in one of the forms. I have several forms in my documents as
>>illustrated
>>below:
>>
>><f:view>
>><h:form id="form1">
>>
>><h:inputText id="name" value="#{backingBean.var1}"/>
>>
>></h:form>
>>
>>
>><h:form id="form2">
>>
>><h:inputText id="address" value="#{backingBean.var2}"/>
>>
>><h:commandButton value="SAVE" action=""/>
>>
>></h:form>
>></f:view>
>>
>>When i clicked the save button, only the address component value in
>>"form2"
>>is saved while the name component in "form1" is not saved. How can
>>I get
>>both the forms to be submitted upon clicking the save button? I
>>tried
>>submitting form1 using the onclick property of the button as below
>>but it
>>didnt work:
>>
>><h:commandButton value="SAVE" action=""
>> />
>
>
>It's considered best practice in JSF to have a single form for each
>page (I typically use <body><h:form> ..... </h:form><body> for all
>of
>my pages. Is there a reason why you can't do this?

Reply via email to