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


Groups > comp.lang.javascript > #20448

Re: How can javascript detect a fieldset in an array of elements

Message-ID <1506321.WIFe3XHvss@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-06-26 02:39 +0200
Subject Re: How can javascript detect a fieldset in an array of elements
Newsgroups comp.lang.javascript
References <379ks8thdutnrglv34mc63mr95kgbglopo@4ax.com> <2529079.e95EOKG17B@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote:

> The reason of the error is most likely not that there is a “fieldset”
> element, but that there are several controls that have the same name.  For
> example, it is common to put a radiobutton group into a “fieldset”
> element. All radiobuttons of a group must have the same name to be
> dependent on one another.
> 
> In that case,
> 
>   elements[i]
> 
> refers to a NodeList of references to those controls.

But that probably does not apply here.  It applies when you access controls 
by name instead of by index.

> An object implementing the NodeList interface does not have a “type”
> property.  As the property does not exist, accessing it results in
> “undefined”, and “undefined” has no properties.
> 
> You can use the fact above to your advantage to find out whether there is
> a group of same-named controls that need to be processed differently:
> 
>   var control = elements[i];
>   if (typeof control.type == "undefined")
>   {

But the second part of the explanation should apply and this approach should 
work regardless.

-- 
PointedEars

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

How can javascript detect a fieldset in an array of elements bugbuster <barryk_56@comcast.net> - 2013-06-25 19:22 -0400
  Re: How can javascript detect a fieldset in an array of elements Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-26 02:34 +0200
    Re: How can javascript detect a fieldset in an array of elements Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-26 02:39 +0200
    Re: How can javascript detect a fieldset in an array of elements John Harris <niam@jghnorth.org.uk.invalid> - 2013-06-26 16:10 +0100
      Re: How can javascript detect a fieldset in an array of elements Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-26 21:21 +0000
        Re: How can javascript detect a fieldset in an array of elements Andrew Poulos <ap_prog@hotmail.com> - 2013-06-27 08:12 +1000
          Re: How can javascript detect a fieldset in an array of elements Tim Streater <timstreater@greenbee.net> - 2013-06-26 23:21 +0100
            Re: How can javascript detect a fieldset in an array of elements Andrew Poulos <ap_prog@hotmail.com> - 2013-06-27 11:58 +1000
        Re: How can javascript detect a fieldset in an array of elements Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-06-27 00:14 +0200
          Re: How can javascript detect a fieldset in an array of elements Christoph Michael Becker <cmbecker69@arcor.de> - 2013-06-27 00:45 +0200
            “javascript”? (was: How can javascript detect a fieldset in an array of elements) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-27 13:36 +0200
              Re: “javascript”? Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-07-29 01:21 +0200
                Re: “javascript”? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-07-30 08:51 +0200
            Re: How can javascript detect a fieldset in an array of elements Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-06-27 14:52 +0200
          Re: How can javascript detect a fieldset in an array of elements "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-06-27 14:04 +0300
            Re: How can javascript detect a fieldset in an array of elements Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-06-27 14:45 +0200
              Re: How can javascript detect a fieldset in an array of elements Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-27 15:11 +0200
        Re: How can javascript detect a fieldset in an array of elements Christoph Michael Becker <cmbecker69@arcor.de> - 2013-06-27 00:45 +0200
          “javascript”? (was: How can javascript detect a fieldset in an array of elements) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-27 14:21 +0200
          Re: How can javascript detect a fieldset in an array of elements John Harris <niam@jghnorth.org.uk.invalid> - 2013-06-27 14:31 +0100
            Parlance (was: How can javascript detect a fieldset in an array of elements) Christoph Michael Becker <cmbecker69@arcor.de> - 2013-06-27 16:21 +0200
              Re: Parlance Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-27 20:46 +0200
                Re: Parlance John Harris <niam@jghnorth.org.uk.invalid> - 2013-06-28 14:33 +0100
                Re: Parlance Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-28 15:54 +0200
                Re: Parlance "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-06-28 17:08 +0300
                Re: Parlance Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-28 17:05 +0200
                Re: Parlance "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-06-28 18:16 +0300
                Re: Parlance Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-28 17:56 +0200
                Re: Parlance Tim Streater <timstreater@greenbee.net> - 2013-06-28 17:54 +0100
                Re: Parlance Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-28 20:50 +0200
                Re: Parlance Andrew Poulos <ap_prog@hotmail.com> - 2013-06-29 07:18 +1000
                Re: Parlance John Harris <niam@jghnorth.org.uk.invalid> - 2013-06-29 17:17 +0100
              Re: Parlance (was: How can javascript detect a fieldset in an array of elements) John Harris <niam@jghnorth.org.uk.invalid> - 2013-06-28 14:53 +0100
                Re: Parlance Christoph Michael Becker <cmbecker69@arcor.de> - 2013-07-15 00:42 +0200
                Re: Parlance John Harris <niam@jghnorth.org.uk.invalid> - 2013-07-15 16:01 +0100
  Re: How can javascript detect a fieldset in an array of elements "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-06-26 08:55 +0300
  Re: How can javascript detect a fieldset in an array of elements Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-06-27 21:27 +0100

csiph-web