I had a related problem.  An Ajax form submit stopped working after the
page returned a StreamResponse.  Manually refreshing the page fixed it,
which provided the clue to a better fix.  (Aided by this list -- there were
a couple of posts on 9/4 and 9/24 about it... maybe this is corrected in a
later version of Tapestry.)

Here's the fix I added to my StreamReponse class.  It works for me but
you'll see the limitations.

public class MyStreamResponse implements StreamResponse {

    public void prepareResponse(Response response) {
        response.setHeader("Expires", "0");
        //... other header settings...

        // Tell the browser to refresh soon after the stream is delivered,
        // with this Refresh header.  It isn't a perfect fix because it
doesn't take effect
        // if the user clicks Cancel on the file-download dialog (if the
user doesn't allow
        // automatic file opening).
        //
        // The refresh will cause the user's form inputs to be lost.
        // Hence I've made the form values page-persistent in pages using
this.

*        response.setHeader("Refresh", "1");*

        //...
    }
}




On Thu, Nov 10, 2011 at 8:48 PM, Steve Eynon <steve.ey...@alienfactory.co.uk
> wrote:

> Sounds like you want a StreamResponse to be returned AND and a page
> refresh at the same time - unfortunately HTTP doesn't allow this.
>
> A technique would be return the page, then re-direct the user to a
> different page / event link which returns the CSV.
>
> It's also discussed in this thread:
>
> http://tapestry.1045711.n5.nabble.com/StreamResponse-on-Success-td2434690.html#a2434692
>
> Steve.
>
>
> On 10 November 2011 19:08, goldenka <maja.polon...@gmail.com> wrote:
> > I have something linke:
> >
> > <input type="text" size="10" t:id="dateTo" value="dateTo"
> > t:format="dd/MM/yyyy" t:type="DateField" validate="required" />
> > <input t:type="submit" class="button" value="Download"/>
> >
> > and validation is server-side (onValidateForm() method) so I think i must
> > use JavaScript. Can you provide me some simple solution ? I think I must
> > remove some div's, but don't know how to do this...
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/Clearing-form-errors-problem-tp4971307p4980738.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > 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