One option is to use a hidden iframe, not technically ajax but it achieves
the same result

2009/10/6 Pete Poulos <pete.pou...@gmail.com>

> Ok, so if what you are saying is correct, then unless I want to use
> yet another technology on this project (which i don't) I will have to
> forget using ajax and reload the whole page?
>
> Can does anyone else have a work around on the problem?  Can anyone
> shed some light on what's going on?
>
> Thanks,
> Pete Poulos
>
> On Mon, Oct 5, 2009 at 8:35 PM, Toby Hobson <toby.hob...@googlemail.com>
> wrote:
> > Its about 12 months since I used Tapestry but if I remember correctly
> file
> > uploads and ajax don't play well together ... it's not specific to T5,
> ajax
> > and multipart forms just don't work together. If I remember correctly I
> used
> > a flash based solution to handle ajax style file uploads ... I'll dig
> > through some of my old code and report back
> >
> > Toby
> >
> > 2009/10/6 Pete Poulos <pete.pou...@gmail.com>
> >
> >> I'm trying to create an ImageUpload component using tapestry-upload.
> >> Once the user selects a file and submits the form, I want to replace
> >> that form with the image itself.  However, I have found an issue where
> >> the form starts behaving differently when I place the tapestry-upload
> >> field inside the form.
> >>
> >> In the code below, when the upload component is NOT present, the
> >> onSuccess() method/event is called when the user presses the submit
> >> button.  However, when the upload component is added to the form, the
> >> form no longer generates the onSuccess() method/event but begins
> >> generating the onSubmit() method/event (which it wasn't previously
> >> doing).
> >>
> >> If you remove the zone parameter from the form, it works as expected
> >> (the form generates onSuccess() while the upload component is
> >> present).
> >>
> >> I am at a complete loss as to what is going on.  Am I doing something
> >> wrong, or is this a bug of some sort?
> >>
> >> Here is some sample code to reproduce the problem.
> >>
> >> Thanks,
> >> Pete Poulos
> >>
> >> .tml file
> >> ----------------------------------------
> >>
> >> <t:zone  t:id="zoneId" id="zoneId"
> >> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
> >> xmlns:p="tapestry:parameter">
> >>         <t:form t:zone="zoneId">
> >>           <t:errors/>
> >>
> >>           <input t:type="upload" t:id="file" validate="required"/>
> >>           <br/>
> >>
> >>           <input type="submit" value="submit" />
> >>         </t:form>
> >> </t:zone>
> >>
> >>
> >> Java File
> >> ---------------------------------------
> >>
> >> public class ImageUpload {
> >>
> >>   @Property
> >>   private UploadedFile file;
> >>
> >> }
> >>
> >>   public void onSubmit() {
> >>      System.out.println( "SUBMIT" );
> >>   }
> >>
> >>   public Object onSuccess() {
> >>       System.out.println( "SUCCESS" );
> >>       return this;
> >>   }
> >> }
> >>
> >> ---------------------------------------------------------------------
> >> 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