RE: Javascript Form Problem

by Andrej Kostresevic <temporalassassin(at)yahoo.com>

 Date:  Fri, 23 Mar 2001 07:19:31 -0800 (PST)
 To:  "Charlton,
Mark" <Mark.Charlton(at)saint-gobain.com>,
"'Sandy Fields'" <sandy(at)sannicron.com>,
hwg-languages(at)hwg.org
 In-Reply-To:  CRYNT40SRV
  todo: View Thread, Original
If none of the radio buttons in a group are selected, the value of the
group will be null. All you need to do is check to see if the value is
null or not. 
This works ONLY if you are using the radio buttons the way they are
supposed to be used - as a group, ie all the buttons have to have the same
name.
--- "Charlton, Mark" <Mark.Charlton(at)saint-gobain.com> wrote:
> it depends on how many buttons you have and how they are set out,
> (grouped),
> but I have used 
> 
> if (document.form.button.value == 'on' ||
> document.form.otherbutton.value ==
> 'on') {
> 	// fine
> } else {
> 	// Some error routine	
> 	alert('please complete form');
> 	return false;
> }
> 
> and it seems to work.  Of the top of my head I can't think of the syntax
> for
> group of radio buttons.
> 
> If the survey is important I would see if you could use a server side
> language like ASP, perl or another to verify the completion as
> javascript
> can be disabled in all browsers and is not active in others.  That then
> depends on the server you are using as to which languages you have
> available.  If you have microsoft IIS and want any help on an ASP
> validation
> routine feel free to drop me a line.
> 
> Good luck
> MC
> 
> -----Original Message-----
> From: Sandy Fields [mailto:sandy(at)sannicron.com]
> Sent: Thursday, March 22, 2001 5:46 PM
> To: hwg-languages(at)hwg.org
> Subject: Javascript Form Problem
> 
> 
> I'm having to build a survey for work. I need a java script (or
> something) 
> that will check to make sure a radio button has been checked for each 
> section before the form will be accepted for submission (ie, script is
> tied 
> to the submit button).
> 
> I've got the script for the text fields. Anyone know of one that works
> for
> radio buttons?
> 
> all help greatly appreciated!
> 
> -- Sandy
> Sannicron Web Design
> http://www.sannicron.com


=====
/***********************************
Andrej Kostresevic
Project manager, Senior Developer
~~~~~~~~~~~~Strashev~~~~~~~~~~~~
Consulting, Design & Development
***********************************/

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA