> -----Original Message-----
> From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 12, 2003 7:37 AM
> To: 'Struts Users Mailing List'
> Subject: Pop-up a window on Submit
> 
> Hi:
> The bottom of my Search.jsp has two buttons.  They are for displaying
> different report (a Main report and a Procedure Summary):
> 
> <html:submit property="mainReport"><bean:message
> key="button.mainReport"/></html:submit>
> <html:submit property="procedureSummary"><bean:message
> key="button.procedureSummary"/></html:submit>
> 
> In my Struts Action class ReportAction I do the following:
> if (formBean.isMainReportAction())
> {
>   this.validateAction(formBean, request, errors);  // validate search
> filters
>   if(errors.empty())
>       retrieve data for main report and display main report
>   else
>       displayed error message
> }
> else if (formBean.isProcedureSummaryAction())
> {
>   this.validateAction(formBean, request, errors);     // validate
search
> filters
>   if(errors.empty())
>       retrieve data for procedure summary report
>       << forward to the template "ProcSummTemplate"
>   else
>       displayed error message
> }
> 
> My struts-config file sort of like this:
> <global-forwards>
>     <forward name="ProcSummTemplate"
> path="/app/report/ProcedureSummary.jsp"/>
> </global-forwards>
> 
> <action    path="/app/report/Search"
>            type="com.test.action.report.ReportAction"
>            name="SearchFormBean"
>            scope="request"
>            validate="false">
>         <forward name="Content" path="/app/report/MainReport.jsp"/>
>         <forward name="ContentError" path="/app/report/Search.jsp"/>
> </action>
> 
> All the above works fine, but now I need to enhance it to do these:
> - If there are no validation errors, pop-up a new window to display
the
> selected report (MainReport.jsp or ProcedureSummary.jsp)
> - If there are validation errors, stay on the same window to display
> validation messages in Search.jsp so user can reenter search filters.
> My questions are:
> 1) How do I pop up a new window with the <html:submit> tag?  Since I
> cannot
> do onSubmit()="return popUpAWindow()" inside the <html:submit> tags
> 2) How do I force Struts to stay in the same window if there are
> validation
> errors, otherwise do the pop-up? My validation method is in the Action
> class
> and not a javascript function.

Hi Pat,

   Try the html code. Name it as test.html. The point is frm.target. You
can manipulate that and achieve what you want. But one issue is the
window which pops up will have location bar, buttons, etc., I don't know
how to hide them. If you do manual window.open you won't receive the
submitted values.

<html>
<head>
<script type="text/javascript" langugage="JavaScript">
<!--
function validateForm(frm)
{
   if (frm.name.value == "")
   {
       alert('name is mandatory');
       return false;
   }
   else
       return true
}
function submitForm(frm)
{
   if (validateForm(frm))
   {
       frm.target = "_blank";
           return true;      
   }
   else
   {
       frm.target = "_self";
           return false;
   }
}
//-->
</script>
</head>
<body>
<form name="frm" action="test.html" onsubmit="return
submitForm(document.frm)">
 name: <input type="text" name="name" value="">
 <input type="submit" name="run" value="Run">
</form>
</body>
</html>

> 
> Thanks in advance.....
> Pat
> 
> 

Regards
Thiru

> 
> 
> 
> Regards,
> Stella Auyeung
> EDS Digital Enablement - Saginaw
> 6200 State Street, Suite 1
> Saginaw,  MI  48603
> 
> * phone: 989-497-5766 (8-399)
> * pager: 989-201-1030
> * mailto:[EMAIL PROTECTED]
> 

This e-Mail may contain proprietary and confidential information and is sent for the 
intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you 
are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, 
copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment 
other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to