Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #31680
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2016-11-10 17:45 -0800 |
| Message-ID | <ba091100-dbad-4f5e-9e2d-ddee43398287@googlegroups.com> (permalink) |
| Subject | How to send dynamically generated document elements to a server side script for data saving? |
| From | justaguy <lichunshen84@gmail.com> |
What I intend to do:
The page allows the user to add dynamic elements (and some of such elements would automatically have an image file associated with it).
that is, it allows a user to
document.createElement('span') etc.
I then, have a function to map all the document elements to a FORM element, specifically a Textarea tag with an id and name.
Problem:
I'm getting objects, instead of objects properties.
See below
[object HTMLHtmlElement][object HTMLHeadElement][object HTMLScriptElement]
...
So, what do I need to do to make it happen?
Thanks.
JavaScript looks like below:
// prepare page/document data for FORM submission
var prep = function() {
// document.getElementById('myData').innerHTML = document.all;
// turn them into array
arr = [].slice.call(document.all);
console.log("array length: " + arr.length);
// copy each into FORM textarea field
for (e = 0; e < arr.length; e++) {
document.getElementById('myData').innerHTML += arr[e];
}
};
Part of the HTML page looks like the following:
<textarea id="myData" name="myData" style="display:none"></textarea>
<br/>
<button onclick="prep(); console.log('verify: ' + document.getElementById('myData').innerHTML);return false;">Verify Data prior to submission</button>
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-10 17:45 -0800
Re: How to send dynamically generated document elements to a server side script for data saving? JJ <jj4public@vfemail.net> - 2016-11-11 21:43 +0700
Re: How to send dynamically generated document elements to a server side script for data saving? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-11-11 16:29 +0100
Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 11:39 -0800
Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 11:39 -0800
Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 12:12 -0800
Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 12:28 -0800
Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 11:38 -0800
csiph-web