javascript - How to submit a JSP form which includes another jsp form using jquery -


hi have pop dialog in jquery (having save , cancel buttons) opening jsp page having form action. inside jsp included jsp save button jsp having action. problem is: when saving 1st jsp without include 2nd jsp, working. after include not working. below code: 1st popup jsp:

function savenewprocess() {          var selindex = $('#prolistframe').contents().find('#selectedindex').val();         /*if (selindex === '') {             alert('select process type');             return;         }         */         var ptype = prolistframe.document.forms[0].protype.value;          if (ptype == 0 || ptype == "") {             alert("select process type create new request.");             return;         }          $('#selectedindex').val(selindex);          if(flag==true){             return;         }         flag=true;         $('#processsavedialog').dialog('destroy').remove();         var url = 'indexfields_new.jsp?id='+ptype+'&hide=true&random='+math.random();         $.get(url, function(data, textstatus) {            $("html, body").animate({ scrolltop: 0 }, "slow");           $("<div id='processsavedialog'/>").dialog({                height: 700,               width: 950,               open:function(){                   $(this).html(data);                   flag=false;               },               buttons: {                   "save process": function() {                    saveprocess();               },               cancel: function() {                   $( ).dialog( "close" );               }               },                       modal: true,               position:['middle',100],               resizable: false,               title: "process save form"            });        });     }       function saveprocess(){              savedata();     }      function savedata(){         if(!checkmandatory()) return false;         $('#indexfields').val(getindexfields());             if(!checkmandatory()) return false;              $('#indexfields').val(getindexfields());             /* alert($('#processsaveform').attr( 'action' )); */             $('#action').val("savenewprocess");             $('#processsaveform').attr('target','prolistframe');             $('#processsaveform').attr('action',$('#processsaveform').attr( 'action' ));             $('#processsaveform').submit();             $('#processsaveform').attr('target','');             alert("processing please wait...");             settimeout(function(){                 alert("process saved successfully");                 window.document.getelementbyid('prolistframe').src = window.document.getelementbyid('prolistframe').src;                $('#processsavedialog').dialog('destroy').remove();             }, 4000); } 

2nd jsp:

<body>  <form name="processsaveform" id="processsaveform" action="process" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" id="action" value="savenewprocess"/>  <table border="0" width="100%" style="float:left">             <%             int i=0,col=0;             for(processindex d:proindex){                  string fields = "";                  string id     = "";                  int indextype = d.getdocumentindextype().getid();                  //system.out.println("index type::: "+indextype);                  string required = "";                  required=(d.getrequired()==1)?" mandatory":"";                  if(indextype==documentindextype.date){                      fields="<input type=\'text\' name=\'idx" + + "\' id=\'idx" + + "\' alt=\'date:" + d.getid() + "\' class=\'date_field"+required+"\' readonly=\'readonly\'>"  ;                  }                  else if(indextype==documentindextype.text){                      fields="<input type=\'text\' name=\'idx" + + "\' id=\'idx" + + "\' alt=\'" + d.getid() + "\' class=\'text_field"+required+"\' >"  ;                  }else if(indextype==documentindextype.drop_down){                      fields="<select name=\'idx" + + "\' id=\'idx" + + "\' title=\'" + d.getid() + "\' class=\'drop_down"+required+"\'>";                      fields += "<option value=\'\'>select</option>";                      list<processindexlist> indlist=processindex.getprocessindexlist(d.getid());                      for(processindexlist ind:indlist){                          fields += "<option value=\'" + ind.getindexvalue() + "\'>" + ind.getindexvalue() + "</option>";                      }                      fields +="</select>";                  }  if(col==0){                      out.write("<tr>");                  }                  col++;i++;                  out.write("<td class=\"lbtext\">"+d.getname()+"</td><td " + id + "valign=\"middle\" >"+ fields +"</td>");                  if(col==1){                      out.write("</tr>");                      col=0;                  }             }            %>            </table>  <table align="center" width="100%" border="0">         <tr><td>&nbsp;</td></tr>         <tr>             <td>                 <div align="center" id="forms" style="display:<%=hide%>;">                 <table align="center" border="0">                     <tr>                         <td align="center"><div  id="content1"> <jsp:include page="../admin/newactivity.jsp"/> </div></td>                     </tr> </table>                 </div>             </td>         </tr>     </table>         <input type="hidden" id="fieldcount" name="fieldcount" value="<%=i%>">         <input type="hidden" id="rights" name="rights" value="<%=rights %>"> </form> </body> 

my 3rd included jsp in 2nd jsp:

<body> <form action="newactivity" name="newactivityform" id="newactivityform" method="post">    <input type="hidden" id="action" name="action"/> <p>new activity</p>     <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #a3a4a9;" id="main_table">         <tr>             <td width="10%" height="20" align="left" bgcolor="#c7cbd6" class="table1">                 <input type="button" value="save" onclick="savenewactivity();"/>             </td>         </tr>      </table>     <table cellspacing="0" style="border: 1px solid black;" cellpadding="0" border="0" bgcolor="white" align="center" width="100%">         <tr><td colspan="100%">&nbsp;</td></tr> <tr>             <td colspan="6"><textarea name="dca_comments" id="dca_comments" cols="50" rows="5"></textarea></td>             <td colspan="6"><textarea name="dca_stamp" id="dca_stamp" cols="50" rows="5"></textarea></td>         </tr>         <tr><td colspan="100%">&nbsp;</td></tr>     </table>     <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #a3a4a9;" id="main_table">         <tr>             <td width="10%" height="20" align="right" bgcolor="#c7cbd6" class="table1">                 <input type="button" value="save" onclick="savenewactivity();"/>             </td>         </tr>      </table>     </form> </body> 

please me on this. totally stucked... thankx in advance...


Comments