[Dojo-interest] Capturing fragment of HTML returned fromformsubmit
Thomas, Jeffrey M.
J.M.Thomas at ngc.com
Thu Jul 13 11:36:03 MDT 2006
Andrew,
Ok..looked into this a bit more and came up with this:
var domDoc = dojo.dom.createDocumentFromText(data);
document.getElementById('theDivToOuputReturnedContentTo').innerHTML =
domDoc.getElementById('idOfFragmentOfReturnedContent').innerHTML;
you could also do something like this (but it is very convoluted, so use
the above one):
target = document.getElementById('theDivToOuputReturnedContentTo');
var node = document.createElement("div");
node.innerHTML = data;
node.style.visibility = "hidden";
node.style.display = "none";
document.body.appendChild(node);
target.innerHTML =
document.getElementById('idOfFragmentOfReturnedContent').innerHTML
- Jeff
________________________________
From: dojo-interest-bounces at dojotoolkit.org
[mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Andrew Madu
Sent: Thursday, July 13, 2006 12:57 PM
To: dojo-interest at dojotoolkit.org
Subject: Re: [Dojo-interest] Capturing fragment of HTML returned
fromformsubmit
Hi Jeff,
well i've got so far:
var domDoc =
dojo.dom.createDocumentFromText(data).documentElement;
var parser = new dojo.xml.Parse();
var parseNodes = parser.parseElement(domDoc);
alert(parseNodes);
At http://manual.dojotoolkit.org/xml/Parse.html, ParseElement is
described as:
'parseElement accepts a node, and returns an object of arrays, making
recursive calls to parseElement as needed for nested child elements.'
The alert reads as [object Object] which is correct, but no matter what
I try and do to access the object I keep getting 'underfined' or 'x is
not a function'. What I should be able to do at this point is
parseNodes.getTagName ("output"), but alas, nothing!!! Any ideas?
regards
Andrew
On 13/07/06, Thomas, Jeffrey M. < J.M.Thomas at ngc.com
<mailto:J.M.Thomas at ngc.com> > wrote:
Oops! Thought data was a DOM node. data is actaully a string
of text (or whatever), so you will have to parse this into a DOM node
first. I have never used dojo utils for this but I just ran across
this:
var some_javascript_var = "<xmltest>test_value</xmltest>";
var testDoc =
dojo.dom.createDocumentFromText(some_javascript_var);
var testObjects = new dojo.xml.Parse
();
// might need to pass testDoc.documentElement or similar
var testItems = testObjects.parseElement(testDoc);
dojo.widget.getParser().createComponents(testItems); //
Added, Cris Perdue
you could try to do something similar.
________________________________
From: dojo-interest-bounces at dojotoolkit.org
[mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Andrew Madu
Sent: Thursday, July 13, 2006 10:41 AM
To: dojo-interest at dojotoolkit.org
Subject: Re: [Dojo-interest] Capturing fragment of HTML returned
fromformsubmit
Alan,
data is the return variable which holds the result of the
submitted form:
formNode: "Form1",
load: function(load, data, e) {
dojo.byId('output').innerHTML = data;
}
data is also the full page which was submitted, which is no good
as you would end up displaying a page within a page each and every time
you submitted the form. So I want to retrieve the node element from
data, which is XML, pertaining to <DIV id="content"/> which holds the
formsection of the returned document. Any ideas how to do this?
regards
Andrew
On 13/07/06, AMurphy at decaresystems.ie <
AMurphy at decaresystems.ie> wrote:
no such thing as data.getElementById - presumably this
was supposed to be
dojo.byId('output').innerHTML =
dojo.byId('data').innerHTML
?
thanks,
Alan
"Andrew Madu" <andrewmadu at gmail.com>
Sent by: dojo-interest-bounces at dojotoolkit.org
13/07/2006 15:15
Please respond to
dojo-interest at dojotoolkit.org
To
dojo-interest at dojotoolkit.org
cc
Subject
Re: [Dojo-interest] Capturing fragment of HTML returned from
formsubmit
Hi Jeff,
thanks for your response. I tried your suggestion:
dojo.byId('output').innerHTML =
data.getElementById('output').innerHTML;
but I get an 'data.getElementById is not a function'
error message. Any ideas what is causing this?
regards
Andrew
On 13/07/06, Thomas, Jeffrey M. <J.M.Thomas at ngc.com
<mailto:J.M.Thomas at ngc.com> > wrote:
If you only want part of the content inside the returned
data variable, I believe you could always do something like:
dojo.byId('theDivToOuputReturnedContentTo').innerHTML =
data.getElementById('idOfFragmentOfReturnedContent').innerHTML;
- Jeff
________________________________
From: dojo-interest-bounces at dojotoolkit.org
<mailto:dojo-interest-bounces at dojotoolkit.org> [mailto:
dojo-interest-bounces at dojotoolkit.org
<mailto:dojo-interest-bounces at dojotoolkit.org> ] On Behalf Of Thomas,
Jeffrey M.
Sent: Thursday, July 13, 2006 9:48 AM
To: dojo-interest at dojotoolkit.org
<mailto:dojo-interest at dojotoolkit.org>
Subject: RE: [Dojo-interest] Capturing fragment of HTML
returned from formsubmit
Andrew,
Refer to
http://dojotoolkit.org/pipermail/dojo-interest/2006-July/012177.html
<http://dojotoolkit.org/pipermail/dojo-interest/2006-July/012177.html>
This example should answer your question.
- Jeff
________________________________
From: dojo-interest-bounces at dojotoolkit.org
<mailto:dojo-interest-bounces at dojotoolkit.org> [mailto:
dojo-interest-bounces at dojotoolkit.org
<mailto:dojo-interest-bounces at dojotoolkit.org> ] On Behalf Of Andrew
Madu
Sent: Thursday, July 13, 2006 4:12 AM
To: dojo-interest at dojotoolkit.org
<mailto:dojo-interest at dojotoolkit.org>
Subject: [Dojo-interest] Capturing fragment of HTML
returned from form submit
Hi,
I have a form submit:
dojo.require("dojo.io.*");
dojo.require("dojo.event.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.xml.Parse");
formNode: "Form1",
load: function(load, data, e) {
dojo.byId('output').innerHTML = data;
}
which is returning the entire html page to my div tag
(output). As transport, is by default, set to XMLHttp how do I return
the fragment of HTML I need as opposed to the entire page?! Basically
when the form is submitted, the form section sits between <DIV
id="output" /> so what I need, in the returned xml, is everything
between <DIV id="output" />.
regards
Andrew
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
<http://dojo.jot.com/FAQ>
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org
<http://manual.dojotoolkit.org/DojoDotBookDojo-interest@dojotoolkit.org>
http://dojotoolkit.org/mailman/listinfo/dojo-interest
<http://dojotoolkit.org/mailman/listinfo/dojo-interest>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org
http://dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org
<http://manual.dojotoolkit.org/DojoDotBookDojo-interest@dojotoolkit.org>
http://dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org
<http://manual.dojotoolkit.org/DojoDotBookDojo-interest@dojotoolkit.org>
http://dojotoolkit.org/mailman/listinfo/dojo-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20060713/c497698a/attachment-0001.html
More information about the Dojo-interest
mailing list