Announcement Announcement Module
Collapse
No announcement yet.
How to submit to a new window ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to submit to a new window ?

    Hi all,

    I have a page (call it page A) where the user enters some report options (filters, sorting options, etc), and then submits this form to display a PDF report (call it page B). B opens in a new window. How I've done this is, in page A :

    <form method="post" target="_blank">
    .......
    </form>

    and A.onSubmit() has :

    return new ModelAndView(new RedirectView(getSuccessView()));

    The problem of course is that if there are binding/validation errors when A is submitted - then it still opens a new window and redisplays A with the errors.

    How can I make A open B in a new window but only after A has successfully finished binding and validation ?

    Thanks in advance !

  • #2
    one way I can think of is, always come back to page A after the submission is processed, the view code for page A can check to see if there are any errors, if not, render a couple of lines of javascript code that opens a new window (would be B).

    Comment


    • #3
      Thanks for the suggestion - I'd actually tried that, but to my serious disappointment this only worked in Mozilla/Firefox and not in IE. The report (PDF) just was not displaying when i used Javascript's window.open.

      cheers.

      Comment


      • #4
        This is obviously out of Spring's scope and I'm not a javascript person, but I just tried this out and it works on both FF and IE (they would get blocked by the blocker in either browser, but that's a different issue):
        Code:
        <html>
        	<script type="text/javascript">
        	window.open&#40;"http&#58;//www.yahoo.com", "abc"&#41;;
        	</script>
        	<body>
        		Hello!
        	</body>
        </html>

        Comment

        Working...
        X