Just to clarify: as Andreas says you have to use javascript as you need
to make two requests in response to one click. So your onclick or bound
handler does something like:

1) Submit form data and loads response (the pdf) in new window. If it is
not possible to specify a target attribute for a form you're going to
have to use a regular GET link with a target=_blank and the data
set/encoded in the url paramaters.

2) Change the url of the current window from details url to summary url.





On Fri, 2011-04-08 at 13:04 +0100, Richard Hill wrote:
> 
> Ah yes sorry I hadn't considered your requirement to submit form data.
> Submitting as a POST complicates things I think. Our web access is down
> so I can't check Google but does an html form element take a target
> attribute or equivalent? Then I guess the response can be loaded in a
> new window. There must be a strategy/pattern for doing this I would have
> thought.
> 
> 
> 
> 
> On Fri, 2011-04-08 at 12:46 +0100, Jim O'Callaghan wrote:
> > Thanks for the suggestion Richard.  One thing I am having difficulty with 
> > (I couldn’t see this in your reply) is how to submit the form data required 
> > to generate the PDF to the server before launching the PDF using 
> > target="blank".  Perhaps I am going about this in a wrong-headed way and 
> > need to rethink the requirement.  I’d welcome any other suggestions if 
> > anyone has one.  I suppose one approach could be to have a submit button 
> > that POSTs the form data, and then redisplay the same page with the submit 
> > button hidden and a new actionLink ‘View PDF’ now present but it seems a 
> > bit clunky.
> > 
> > Regards,
> > Jim.
> > 
> > From: Richard Hill [mailto:r...@su3analytics.com] 
> > Sent: 08 April 2011 12:26
> > To: Tapestry users
> > Subject: Re: Popup PDF
> > 
> > 
> > The simplest way I'm guessing is to have your link that
> > generates/returns the pdf to be a target="_blank" as you say.
> > 
> > Then in javascript change the window url from the detail url to the
> > summary url.
> > 
> > If adding your own js to an actionlink is tricky you could not use an
> > action (or page) link, but do the whole thing in javascript - open a new
> > window with the appropriate url for the pdf, and then load the summary
> > page in the current window.
> > 
> > Or maybe a mixin would work if you want to add your own js to an action
> > or page link?
> > 
> > 
> > Richard.
> > 
> > 
> > 
> > 
> > On Fri, 2011-04-08 at 11:56 +0100, Jim O'Callaghan wrote:
> > > I have a requirement to generate a PDF based on some submitted form data 
> > > in
> > > a 'detail' page, and then pop up the PDF in a new tab/window while at the
> > > same time returning from the 'detail' page to a 'summary' page.  I don't
> > > want to pollute the summary page with any code related to opening the PDF 
> > > in
> > > a new tab/window.  The actual PDF is being generated and I can return that
> > > as a stream successfully but I'm trying to find out how to return the
> > > summary page in the existing tab/window, and also trigger the PDF opening 
> > > in
> > > another tab/window, as effectively I'm trying to generate two server
> > > responses for one server request.  Can anyone suggest a good way of going
> > > about this?  Should I put something in the detail page that triggers an
> > > actionLink with  target="_blank" before redirecting to the summary page?
> > > Thanks.
> > >
> > > Regards,
> > > Jim.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > >
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> > ________________________________________
> > No virus found in this message.
> > Checked by AVG - www.avg.com
> > Version: 10.0.1209 / Virus Database: 1500/3558 - Release Date: 04/07/11
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to