0

If we have several forms like below and when i finally press submit button, it should send all the values from "froms1 to forms3" to the server. Is it something possible? I am using primefaces.

<h:form id="forms1">
 <inputText .........
 </h:form>
......
<h:form id="forms2">
 ......
</h:form>
.......
<h:form id="forms3">
.....
</h:form>

<p:commandButton value="submit" action="#{bean.action}" onSubmit="this.forms1,this.forms2,this.forms3" partialSubmit="true" />
Coool Awesome
  • 145
  • 1
  • 5
  • 16
  • why do you need 3 different form then ? – jmj Jul 25 '12 at 18:29
  • did it even work? shouldn't be inside a ? – jay c. Jul 25 '12 at 18:33
  • It would be better if you could edit your post and answer Jigar question. If there is no good reason to have 3 different forms, then you should use 1 big form to catch all the data. If your forms are inside a or something like this and they have inner submits in it, you should add the `execute="@container"` attribute to improve the data sent to the server. – Luiggi Mendoza Jul 26 '12 at 03:40

2 Answers2

2

You may be able to put some hacky solution together to submit 3 forms with one button, but it would be best to just use 1 form with 1 submit button inside the form.

If you're using multiple forms to get some separation with the way things look, try using fieldsets instead. Primefaces even has a fieldset component <p:fieldset></p:fieldset>

Catfish
  • 18,876
  • 54
  • 209
  • 353
-1

it is not a good idea to submit multi ple form but you can submit by following code..

<p:commandButton title="Submit" value="Submit" action="#{bean.action}" process="form1,form2,form3">

this may work 4 you...

Harshit Shah
  • 319
  • 1
  • 2
  • 11