On 26 nov, 22:04, Mohamed Mansour <[email protected]> wrote: > Hmm, my post formatted it all wrong. Here it is again: > > --------------------------------------------------------------------------- > ---- > > I am using FileUpload widget within a FormPanel. Basically, I am > sending an XML file to FileUpload to test.jsp, where that JSP file is > sending that text file back wrapped in a <Result> tag. > > The problem is that event.getResults() from the SubmitCompleteHandler > trims off the result from the beginning. The XML File I am sending is > 110lines, where the result should be: > <Result> > <Title>Import XML</Title> > <Status>true</Status> > <Data> > .... > </Data> > </Result> > > But I am only getting the following back: > true</Status> > <Data> > .... > </Data> > </Result> > > Any ideas why?
To get the SubmitCompleteEvent, you have to send the result back as text/html, which also means it'll be interpreted as HTML by the browser (even if it gets loaded in a hidden iframe, it still is an iframe). Here, the <Result> is ignored because it's not a known element, then <Title>Import XML</Title> is parsed as the document's title (the one that'd be displayed in the window title bar or tab if the document were showed in a "full window" rather than an iframe), then again <Status> is ignored, and finally "true" implies the <body> start tag (and is parsed as the very first document's body content). Given that SubmitCompleteEvent::getResults() returns the document.body.innerHTML of the iframe, it effectively starts with the "true" and everything before it is somehow "ignored". Conclusion: if you want to send anything containing "<" and "&" in response to a FormPanel submission, escape it (< and &) on the server-side and then unescape it on the client-side. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
