Re: Handle XForms Submit whith XmlHttpRequest

Landry,

> I can't use Xforms because with Xforms, when you click a submit for example, the
> submission object will built the http request and send it to server. Next, the browser
> will handle server response and show it in the page (roundtrip). The matter with this is
> that I have more forms and other information on the page and I just want to refresh the
> appropriate area that contains the form that was submit.

This is why @replace="instance" / @instance="x" was added to
xf:submission; an XForms processor will replace the current form if
you have @replace="all" or you don't have a @replace attribute.


> Il place, I will user a <xforms:setvalue value="handlerequest(.)"/> that will call a generic
> JavaScript function.

Now I'm very confused...so you must be using XForms in some form or
another. What processor are you using?


> This function have to do the same responsibility the submission will
> do, but by usin an XmlHttpRequest object. Then, this function will refresh the div that
> contains Xforms form with return data.

If you are trying to get a 'subform' effect, then I would let
submission run its course, and at the end you will have an instance.
Then use the DOM methods on xf:model to get the instance document as a
DOM, and then copy that into your div. Of course, if the returned data
contains XForms then you'll need your XForms processor to be able to
cope with reparsing, which a server-side processor is unlikely to be
able to do. (Can't have it all your own way, Erik. :)


> I want to know if this solution is smart and realistic and if somebody have deal with this
> in the past.

I can't say, since I don't know what problem you are trying to solve.
You could help everyone if you say what XForms processor you are
using, since then we could tell whether you really, really must use
XMLHttpRequest, or whether you are merely trying to achieve the same
effect as an Ajax form that performs some kind of incremental loading.

Regards,

Mark


-- 
Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/

Received on Thursday, 6 July 2006 12:22:28 UTC