Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #7504
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!s09-11.readnews.com!unm2.readnews.com.POSTED!not-for-mail |
|---|---|
| X-Trace | DXC=gl\9cBaITO7>^F7R=Th`J8@lWf8?fSK:1jS@R6]oDiI?[j;g`C24>V;o=iH@LQ<Yb0eSRSQ__ojF9AoTk2Vd?<7;DOQjW]Lg[23>D1Mm`\3ob7`HUFW34RQU; |
| X-Complaints-To | abuse@gradwell.net |
| From | Denis McMahon <denismfmcmahon@gmail.com> |
| Subject | Re: Syntax for resetting radio button to initial value? |
| Newsgroups | comp.lang.javascript |
| References | <j7fhjv$btu$1@dont-email.me> |
| User-Agent | Pan/0.133 (House of Butterflies) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Date | 17 Oct 2011 10:56:53 GMT |
| Lines | 39 |
| Message-ID | <4e9c09f5$0$28616$a8266bb1@newsreader.readnews.com> (permalink) |
| Organization | readnews.com - News for Geeks and ISPs |
| NNTP-Posting-Host | abe65125.newsreader.readnews.com |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.javascript:7504 |
Show key headers only | View raw
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. 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: <form> <input type="radio" value="1" name="music"> Classical<br> <input type="radio" value="2" name="music"> Jazz<br> <input type="radio" value="3" name="music" checked="checked"> Rock<br> <input type="submit"><input type="reset"> </form> If I don't want the default option to be visible for a radio button set, what I usually do is something like this: <form> <input type="radio" value="0" name="music" checked="checked" style="display:none"> <input type="radio" value="1" name="music"> Classical<br> <input type="radio" value="2" name="music"> Jazz<br> <input type="radio" value="3" name="music"> Rock<br> <input type="submit"><input type="reset"> </form> Now a value of "0" means "none of the visible options was selected". It may be that the latter is a solution to your problem too. Rgds Denis McMahon
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar
Syntax for resetting radio button to initial value? "Garry Jones" <garry@garryjones.se> - 2011-10-16 23:16 +0200
Re: Syntax for resetting radio button to initial value? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-10-17 00:46 +0300
Re: Syntax for resetting radio button to initial value? dhtml <dhtmlkitchen@gmail.com> - 2011-10-16 22:56 -0700
Re: Syntax for resetting radio button to initial value? Matt McDonald <matt@fortybelow.ca> - 2011-10-16 16:49 -0600
Re: Syntax for resetting radio button to initial value? dhtml <dhtmlkitchen@gmail.com> - 2011-10-16 22:57 -0700
Re: Syntax for resetting radio button to initial value? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-17 09:56 +0200
Re: Syntax for resetting radio button to initial value? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-17 09:51 +0200
Re: Syntax for resetting radio button to initial value? Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-17 10:56 +0000
Re: Syntax for resetting radio button to initial value? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-17 14:32 +0200
Re: Syntax for resetting radio button to initial value? Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-17 11:16 +0000
Re: Syntax for resetting radio button to initial value? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-17 14:45 +0200
Re: Syntax for resetting radio button to initial value? "Garry Jones" <garry@garryjones.se> - 2011-10-17 20:31 +0200
Re: Syntax for resetting radio button to initial value? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-18 10:45 +0200
Re: Syntax for resetting radio button to initial value? Dr J R Stockton <reply1142@merlyn.demon.co.uk> - 2011-10-18 20:50 +0100
csiph-web