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


Groups > comp.lang.javascript > #7512

Re: Syntax for resetting radio button to initial value?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From "Garry Jones" <garry@garryjones.se>
Newsgroups comp.lang.javascript
Subject Re: Syntax for resetting radio button to initial value?
Date Mon, 17 Oct 2011 20:31:54 +0200
Organization A noiseless patient Spider
Lines 2
Message-ID <j7hsaq$1gr$1@dont-email.me> (permalink)
References <j7fhjv$btu$1@dont-email.me> <4e9c0e71$0$28585$a8266bb1@newsreader.readnews.com>
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="utf-8"; reply-type=original
Content-Transfer-Encoding 7bit
Injection-Date Mon, 17 Oct 2011 18:31:54 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="Rvf98n6RDnNul/Y7sq77+g"; logging-data="1563"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PmHXpqeKrjP97hu2x4R+oAViYnE0oCBY="
In-Reply-To <4e9c0e71$0$28585$a8266bb1@newsreader.readnews.com>
X-Antivirus-Status Clean
X-Newsreader Microsoft Windows Live Mail 15.4.3538.513
Importance Normal
X-Antivirus avast! (VPS 111017-0, 2011-10-17), Outbound message
Cancel-Lock sha1:+yLqscqWFyMm3ytIdapA9+svkkI=
X-Priority 3
X-MSMail-Priority Normal
X-MIMEOLE Produced By Microsoft MimeOLE V15.4.3538.513
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:7512

Show key headers only | View raw


"Denis McMahon"  wrote in message 
news:4e9c0e71$0$28585$a8266bb1@newsreader.readnews.com...

Then change:
<input type="radio" name="r1" value = "0"> No Thanks<br>
to:
<input type="radio" name="r1" value = "0" id="someUniqueId"> No Thanks<br>
and then use the javascript:
document.getElementById("someUniqueId").checked = true;

Yes, brilliant. That did it.

My problem is there are two ways to reset the form. The user can have called 
in the form from different places and the initial radio button value is a 
user value. So a form reset just resets to the initial user value whilst 
this code is just what I needed and it resets the form to a global default 
value for the user to start again.

I am very thankful to everyone who posted. I am fairly home in php and sql 
but quite limited in javascript, I usually google pieces of code and adapt 
them to suit my needs. Biggest problem with this Crome, Safari, Firefox, 
Opera and MSIE treat javascript code differently and whilst php, sql etc 
behave the same everywhere I find javascript to be a pain, its like allowing 
foreign drivers to drive on the same side of the road as they do back home 
and building a road system to allow this. Anyway, gripe over, I'm happy and 
think its wonderful USENET can still outgun message boards and FAQ's in 
2011.

Garry Jones
Expat in Sweden

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


Thread

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