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


Groups > comp.lang.javascript > #32197

Re: form sending undefined

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: form sending undefined
Date 2017-01-19 18:19 +0100
Organization PointedEars Software (PES)
Message-ID <5790110.4vTCxPXJkl@PointedEars.de> (permalink)
References <69ednX2-9KdxNODFnZ2dnUU7-cPNnZ2d@westnet.com.au> <1645793.CQOukoFCf9@PointedEars.de> <1pKdnbi_ecMsjx3FnZ2dnUU7-KfNnZ2d@westnet.com.au>

Show all headers | View raw


Andrew Poulos wrote:

> On 18/01/2017 2:16 AM, Thomas 'PointedEars' Lahn wrote:
>> Andrew Poulos wrote:
>>> How do the values become undefined?
>> There is no way that this code can cause the “undefined” value.
>> The problem must be in the code that you have not posted.
> 
> Looking through everything again one of the fields had an id and name of
> "name" and at a guess that is probably an unsafe name.

Yes, if you attempt to access the “name” property of the “form” element 
object.  Because legacy DOM support will make that property inaccessible in 
favor to shorthand access to a form control with name or ID “name” in that 
form:

| > $0.name
| <input name=​"name">​

(when will they finally remove support for the ambiguous shorthand and fix 
this?).  The same as naming a form control “submit” will make the “form” 
element object’s submit() method inaccessible:

| > $0.submit
| <input name=​"submit">​
| 
| > $0.submit()
| Uncaught TypeError: $0.submit is not a function(…)

[$0 is an expression referring to to the element object representing the 
node selected in the Element’s panel of several browser developer tools, 
including Chrome DevTools where this was tested.]

However, I do not see an intrinsic relationship between your “undefined” 
result and unsafe naming.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | 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

form sending undefined Andrew Poulos <ap_prog@hotmail.com> - 2017-01-17 16:21 +1100
  Re: form sending undefined JJ <jj4public@vfemail.net> - 2017-01-17 15:15 +0700
  Re: form sending undefined "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-17 15:29 +0100
  Re: form sending undefined Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-17 16:16 +0100
    Re: form sending undefined Andrew Poulos <ap_prog@hotmail.com> - 2017-01-19 12:13 +1100
      Re: form sending undefined Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-19 18:19 +0100
        Re: form sending undefined Andrew Poulos <ap_prog@hotmail.com> - 2017-01-20 07:28 +1100

csiph-web