Does anyone have an idea on this? Is my presentation of the issue missing clarity/details ? Regards, Jeremie
2011/12/6 Jérémie Charlet <charlet.jere...@gmail.com> > Hello everyone, > > I am facing an issue while using ajaxFormLoop: > > On my page, I fill a form that includes among others a list of > phoneNumbers to be set in an ajaxFormLoop. Once I submit the form, it > generates a PDF (containing data from my form) and makes the user download > it in his web browser. The user is not redirected to another page, the page > is simply reloaded so that the user can fill once again the form and > generate a new PDF. > > Problem is that once the page is reloaded (and my PDF file asked to be > download), I cannot use the ajaxFormLoop anymore: if I click on addRow, > nothing happens on the GUI. However if I reload manually the page, the > ajaxFormLoop works back again and displays moreothers as many rows as I > clicked previously on the addRow button. It seems that once I click on > addRow, requests are indeed done server side, but the javaScript doesn't > work anymore and and does not refresh the GUI and show the added rows. > > The problem might occur because in the function handling the submit event, > I return a PDFStreamResponse instead of the tapestry page but I don't see > how to solve it.. Return the PDFStreamResponse and somehow reload > immediately after the page, but how? Is there a better way to make the user > download the generated PDF? > > > the ajaxFormLoop from the tml > > <div t:type="ajaxformloop" t:id="phoneNumberLoop" t:value="phoneNumberRow" > t:source="phoneNumberList" t:encoder="phoneNumberRowEncoder"> > <t:unless t:test="phoneNumberRow.toDelete"> > <t:submitnotifier> > <t:layout.twocolumn padding="0" rightColumnWidth="20"> > <p:leftColumn> > <p> > <t:label for="phoneNumber"> > ${sharedcatalog:phoneNumber} > </t:label> > <t:textfield t:id="phoneNumber" t:value="phoneNumber" > t:validate="required" /> > </p> > </p:leftColumn> > <p:rightColumn> > <p> > <t:removerowlink> > ${sharedcatalog:deletephoneNumber} > </t:removerowlink> > </p> > </p:rightColumn> > </t:layout.twocolumn> > </t:submitnotifier> > </t:unless> > <p:addRow> > <div style="clear: both;"> > <p> > <t:addrowlink> > ${sharedcatalog:addphoneNumber} > </t:addrowlink> > </p> > </div> > </p:addRow> > </div> > > > the submit event handled in the java class > > @OnEvent(component = "myForm", value = EventConstants.SUBMIT) > public Object generatePDF() { > > InputStream pdfStream = null; > try { > pdfStream = pdfGeneratorService.generateMandatePDF(); > } catch (PDFGeneratorServiceException e) { > e.printStackTrace(); > } > > // return the PDF as a PDFStreamResponse > return new PDFStreamResponse(pdfStream, "Addresses_" + > System.currentTimeMillis() + ".pdf"); > } > > > Thanks in advance for the help :), > Jérémie >