W3C home > Mailing lists > Public > www-forms@w3.org > November 2008

A new submit method for implementing replace="all" with Javascript ?

From: COUTHURES Alain <alain.couthures@agencexml.com>
Date: Sat, 22 Nov 2008 18:48:59 +0100
Message-ID: <4928460B.7020109@agencexml.com>
To: www-forms@w3.org

Hello,

Reading XForms 1.0 Recommendation and XForms 1.1 Candidate 
Recommendation, I think it might be useful to add another way of 
serialization as application/x-www-form-urlencoded with just one input 
field containing the serialized XML.

The problem I'm encountering is about implementing ' replace="all" ' in 
Javascript. I am re-engineering AJAXForms 
(http://www.agencexml.com/xsltforms) and, after replacing Java parts 
with an XSL transformation so it can be client-side, I have to modify 
Javascripts submit parts. AJAXForms, which was not designed for XHTML, 
is using XMLHttpRequest and "document.write()".

First, I replaced "document.write(req.responseText)" with 
"document.documentElement.parentNode.replaceChild(req.responseXML.documentElement,document.documentElement)" 
for XHTML response and "document.documentElement.innerHTML = 
req.responseText" for non XHTML response (I should actually process all 
childNodes of document.documentElement.parentNode...) . But, even so, it 
doesn't work perfectly for FF3 (title not updated !) and Opera (display 
not fully cleared !), and the previous URI is, of course, still the 
current one : reload and backward buttons do not act as if it were a new 
page...

I would prefer browsers to completely replace the page the way they 
usually do for HTML form submit or for HTML anchor : XSL transformation 
if mentioned, CSS import, Javascript execution,... It would prevent 
memory leak and every kind of problems resulting from a unique page been 
modified, and modified, and modified...

So, instead of XMLHttpRequest, HTML form submit would do the trick but, 
at least, one input field is required. Just one input field, named 
"postdata" for example, would be good to contain the serialized XML. 
This new submit method could be named "xml-urlencoded-post".

I would appreciate to have your points of view.

Thank you in advance.

Alain COUTHURES
<agenceXML>
http://www.agencexml.com
Bordeaux, France
Received on Saturday, 22 November 2008 17:49:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:14 GMT