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="#{backingBean.save}"/> </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="#{backingBean.save}" onclick="document.forms['form1'].submit()" />
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?

