Quantcast

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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

lupus
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>

Remote form action demo:


<div id='outputArea1'> </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'> </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>


 <INPUT TYPE="button" value="Mass Submit" onClick="MassSubmit();">

</body>
</html>
Loading...