Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <1768275.D2KPVSPYKU@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Mon, 17 Oct 2011 14:32:20 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: Syntax for resetting radio button to initial value? Newsgroups: comp.lang.javascript References: <4e9c09f5$0$28616$a8266bb1@newsreader.readnews.com> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 61 NNTP-Posting-Date: 17 Oct 2011 14:32:20 CEST NNTP-Posting-Host: 7b7affea.newsspool3.arcor-online.net X-Trace: DXC=0AK8\F<_U93D]ncZ]`hZ;1McF=Q^Z^V384Fo<]lROoR18kFDZm8W4\YJNE8D2cDn9 X-Complaints-To: usenet-abuse@arcor.de Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:7506 Denis McMahon wrote: > On Sun, 16 Oct 2011 23:16:48 +0200, Garry Jones wrote: >> I have a reset function for a user form which clears text fields, resets >> drop down boxes to initial values and moves focus to first input field. >> However I need to reset radio buttons to their inital value (of zero). > > Radio buttons shouldn't have an initial value of zero. What would be the reason for that? > A radio group is a group of buttons of which one and only one is > selected. This is the default option for the group, and should be marked > as such, eg: > >
> Classical
> Jazz
> Rock
> >
That's HTML5 at most. But imagine what would happen if you simply omitted the `checked' attribute. It's optional, you know. BTW, including a reset button in a form is almost always a stupid idea: > If I don't want the default option to be visible for a radio button set, > what I usually do is something like this: > >
> style="display:none"> > Classical
> Jazz
> Rock
> >
> > Now a value of "0" means "none of the visible options was selected". Works great with and without CSS. NOT. It's complete utter nonsense; don't *ever* do this. If you don't pre-check any radiobutton of a radiobutton group, it will not be part of the request. There is absolutely no need to transmit a "hidden" default value for a radiobutton group. Not that this code would have *anything* to do with the OP's question. > It may be that the latter is a solution to your problem too. It does not even address the problem. Would you *please* get a minimum clue before making suggestions. PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann