Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31699

Re: How to send dynamically generated document elements to a server side script for data saving?

Path csiph.com!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: How to send dynamically generated document elements to a server side script for data saving?
Date Fri, 11 Nov 2016 16:29:27 +0100
Organization PointedEars Software (PES)
Lines 37
Message-ID <1767224.PIDvDuAF1L@PointedEars.de> (permalink)
References <ba091100-dbad-4f5e-9e2d-ddee43398287@googlegroups.com> <1fkka1wzfld0h$.h1uvn3rxzhzz.dlg@40tude.net>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1478878168 23571 eJwFwYEBwCAIA7CXBEqZ5wid/59gkkHjFJhE3rw3NMVCaxTetWzLo/2bOIKVZlZuNM2ho/8BJpMRgQ== (11 Nov 2016 15:29:28 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Fri, 11 Nov 2016 15:29:28 +0000 (UTC)
User-Agent KNode/4.14.2
X-NNTP-Posting-Host eJwFwQkBwEAMAjBLfaC3ymEP/iUsYU/OczAc0PTU6uu6t+xWZvRmvbM6dwQTRDUkG7F7CT8IThAz
Cancel-Lock sha1:5I8yEwc7EjDbxotwYK/Dv3uOdSw=
X-User-ID eJwNxdERBFEEBMCUOAwvHIXJP4S9/ukwKCYdAQ8GsQt7/D2L7hROjFyrag3X3kbOjKOWnn4leVek3D/Qej9oNRad
Xref csiph.com comp.lang.javascript:31699

Show key headers only | View raw


JJ wrote:

> On Thu, 10 Nov 2016 17:45:24 -0800 (PST), justaguy wrote:
>> 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.
> 
> That's because an element object won't become a HTML code string when the
> object is converted to string. You need to use its outerHTML property if
> you want its HTML code.

However, this wish is probably based on a flawed approach as the attributes 
of the element, and its descendants and their attributes, are available as 
and via properties in the document tree.  By contrast, serialization of 
element objects using the “outerHTML” property will rarely yield appropriate 
results, as it will yield results that you have no control over (unless you 
parse them again, but then why did you serialize in the first place?).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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