Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Struts 2 Ajax forms-multiple forms with one submit, how?

lupus

2007-08-06



Is it possibe to have one submit for several ajax forms instead of submitting
each Ajax form? I tried to use javascript to submit two form actions, but
only the second one in my javascript submit list is displayed and the result
is displayed in a different page instead of in the defined target area in
the same page as the submit button, ...

Here is what I am doing:

<html>
<head>
  <title>Ajax Examples</title>
  <s:head theme="ajax"/>
 
  <SCRIPT LANGUAGE="JavaScript">
 <!--
 function MassSubmit()
 {
   document.frm1.submit();    
   document.frm2.submit();
 }
 
 //-->
 </SCRIPT>
</head>

<body>
<h1>Remote form action demo:</h1>

<div id='outputArea1'>&nbsp;</div>
<s:form
    name="frm1"
    id='theFormAccess1'
    cssStyle="border: 1px solid green;"
    action='AjaxRemoteForm1'
    method='post'
    theme="ajax">
   
    <input type='text' name='test1' value=''>
    <s:submit value="Submit" theme="ajax" targets="outputArea1"/>
</s:form>

<div id='outputArea2'>&nbsp;</div>
<s:form
    name="frm2"
    id='theFormAccess2'
    cssStyle="border: 1px solid green;"
    action='AjaxRemoteForm2'
    method='post'
    theme="ajax">
   
    <input type='text' name='test2' value=''>
    <s:submit value="Submit" theme="ajax" targets="outputArea2"/>
</s:form>

<!-- Mass submit form1 and form 2-->
<INPUT TYPE="button" value="Mass Submit" onClick="MassSubmit();">

</body>
</html>
--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.