struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nisith Dash" <nisith_...@tcscal.co.in>
Subject how to submit a action form using a javascript(pop-up).
Date Fri, 26 Sep 2003 15:53:00 GMT
Hi all,

I have a problem and need you help for resolution.I have a JSP struts page with an action
form with typically save,delete buttons.One of the fields in this form is a search criteria
field with a Go button which should basically display the results in a new pop up window.I
have associated a new action class for this button.I want to submit the entire action form
associated with this page  to be submitted when i click the Go button through a javascript
function.  

Also when i select a value in the popup window and return back to the main form, the values
already existing  in the action form should not get repopulated(ie avoiding the call to the
reset method of the action class).


I am providing the code snippet for the same, in which i have been able to pass the search
parameter rather than submitting entire action form:

function openSearchProductPopup()
  {
         var URL= '/rpm/findCompanyCdAction.do?searchcode='+BusinessDivisionForm.ecmPkey.value;
         features="alwaysRaised=yes,dependent=yes,menubar=no,toolbar=no,scrollbars=yes,height=400,width=600";
         window.open(URL,"",features);
  }


<html:form  action="createBusinessDivisionAction">
          <table id=Table5 cellSpacing=1 cellPadding=1 width="100%" border=0>
            <label  class=prompt> Company Id:</label></div>
              </td>
              <td height=26 > 
                <html:text property="ecmPkey" maxlength="38" styleClass="inputCellNumShaded"/>
                <html:button  styleClass="button" property="go"  value="Go"  onclick='openSearchProductPopup();'
/>
              </td>
              <td align=left height=26> 
                <div align=right class="prompt"><span class=requiredFieldAsterisk>*</span>&nbsp;<label
class=requiredFieldPrompt> Division Id:</label></div>
              </td>
              <td height=26 > 
                <html:text property="divisionCd" maxlength="15" styleClass="inputCellShaded"/>
              </td>
              <td width="43" height=26></td>
            </tr>
            <tr> 
              <td width="46" height="33"></td>
              <td align=left height=33> 
                <div align=right class="prompt"><span class=requiredFieldAsterisk>*</span>&nbsp;<label
class=requiredFieldPrompt> Divsion Name:</label></div>
              </td>
              <td class="prompt" height="33"> 
               <html:text property="divisionName" maxlength="100" styleClass="inputCellShaded"/>
              </td>
              <td class=prompt align=right height="33">&nbsp;</td>
              <td colSpan=2 height="33" width="185">&nbsp; </td>
            </tr>
            <tr> 
              <td width="40"></td>
              <td class="prompt" align=right><label class=prompt>Created By:</label></td>
              <td width="186"> 
                <html:text property="userCreated" maxlength="10" styleClass="formObjReadOnly"
readonly="true"/>
              </td>
              <td class=prompt align=right> 
                <div align=right><label class=prompt>Created On:</label></div>
              </td>
              <td width="250" > 
                <html:text property="dateCreated" maxlength="7" styleClass="formObjReadOnly"
readonly="true"/>
              </td>
              <td width="10"></td>
            </tr>
            <tr> 
              <td width="40"></td>
              <td class=prompt align=right> 
                <div align=right><label
                class=prompt>Last Updated By:</label></div>
              </td>
              <td width="186" > 
                <html:text property="userLastUpd" maxlength="10" styleClass="formObjReadOnly"
readonly="true"/>
              </td>
              <td class=prompt align=right> 
                <div align=right><label class=prompt>Last Updated On:</label></div>
              </td>
              <td width="250" > 
                <html:text property="dateLastUpd" maxlength="7" styleClass="formObjReadOnly"
readonly="true"/>
              </td>
              <td width="10"></td>
            </tr>     
             <html:hidden property="ebdPkey" />
            <tr> 
              <td width="600" colspan="5"> 
                <div align="left"> 
                <html:button onclick='createForm();'  styleClass="button" property="Save"
value="Save" />&nbsp;&nbsp;<html:button onclick='deleteForm(); '        styleClass="button"
property="Delete" value="Delete" />&nbsp;&nbsp;<html:button  styleClass="button"
property="Reset" value="Reset" />&nbsp;&nbsp;<html:button  styleClass="button"
property="Close" value="Close" />&nbsp; </div>
              </td>
              <td width="43"></td>
            </tr>            
          </table>        
        </html:form>


and the struts config is as follows:

<action path="/findCompanyCdAction" 
            type="com.rpm.application.common.action.FindCompanyCdAction"
            input="/jsp/common/RPMCOM002MaintainDivision.jsp"> 
            name="BusinessDivisionForm"       
            scope="request">    
             <exception type="com.rpm.framework.exception.RPMCustomWrappedNonRecoverableException"

              handler="com.rpm.framework.exception.handler.RPMExceptionHandler" 
              path="/jsp/common/RPMCOM002MaintainDivision.jsp" key="" scope="request"/>
           <forward name="success" path="/jsp/common/RPMCOM022ListCompanyDetails.jsp" 
/>
           <forward name="default" path="/jsp/common/RPMCOM002MaintainDivision.jsp"  />
</action>   

Thanks in advance,

Nisith
Mime
View raw message