473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Code Direction for radio button error check

Hi Guys,

I know to error check a drop down field called "Reason" i would use.

if (document.HTML_FORM.Reason.options[0].selected == 1)
errorMsg += "The field Reason is mandatory and has been left blank\n";

and I know to check a text field I would use,

if (!(document.HTML_FORM.Reason.value))
errorMsg += "The field Reason is mandatory and has been left blank\n";

Question I have what code would I use for a Group of Radio buttons? I have tried the .value option.

John
Feb 22 '07 #1
4 1877
r035198x
13,262 8TB
Hi Guys,

I know to error check a drop down field called "Reason" i would use.

if (document.HTML_FORM.Reason.options[0].selected == 1)
errorMsg += "The field Reason is mandatory and has been left blank\n";

and I know to check a text field I would use,

if (!(document.HTML_FORM.Reason.value))
errorMsg += "The field Reason is mandatory and has been left blank\n";

Question I have what code would I use for a Group of Radio buttons? I have tried the .value option.

John
Java != Javascript

Moved to Javascript forum
Feb 22 '07 #2
abctech
157 100+
Hi Guys,

I know to error check a drop down field called "Reason" i would use.

if (document.HTML_FORM.Reason.options[0].selected == 1)
errorMsg += "The field Reason is mandatory and has been left blank\n";

and I know to check a text field I would use,

if (!(document.HTML_FORM.Reason.value))
errorMsg += "The field Reason is mandatory and has been left blank\n";

Question I have what code would I use for a Group of Radio buttons? I have tried the .value option.

John
this might be of help.
Feb 22 '07 #3
Top draw I got there in the end. Thank you.

var radIndex;
var INOUTIndex = 2;

for (radIndex = 0; radIndex < document.HTML_FORM.Movement_INOUT.length; radIndex++)
{
if (document.HTML_FORM.Movement_INOUT[radIndex].checked == false)
errorMsg += "Please Select In or Out on your Movment\n";
{
INOUTIndex = radIndex;
break;
}
}
Feb 23 '07 #4
abctech
157 100+
Top draw I got there in the end. Thank you.

var radIndex;
var INOUTIndex = 2;

for (radIndex = 0; radIndex < document.HTML_FORM.Movement_INOUT.length; radIndex++)
{
if (document.HTML_FORM.Movement_INOUT[radIndex].checked == false)
errorMsg += "Please Select In or Out on your Movment\n";
{
INOUTIndex = radIndex;
break;
}
}
You are welcome, glad it helped.
Feb 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
11
by: hygum | last post by:
I have combination of radio and select/input: http://sneleopard.dk/radio.html Is there a javascript which automatically sets radio 1, when the user does something with field 1, and automatically...
3
by: John Davis | last post by:
I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons. When the user click the first radio button, the text will change to uppercase. If the user clicks the other radio button,...
0
by: vinay | last post by:
why are u not using the radiobutton list??? vinay >-----Original Message----- >I created a simple ASP.NET application with a text field, and 2 radio >buttons (uppercase and lowercase...
4
by: Craig831 | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
8
by: stefano | last post by:
HI, I have aproblem with XHTML radio button. <form name=" form"> <input name="radio" type="radio" onclick="return false" /> <input name="radio" type="radio" onclick="return false" /> <input...
1
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
3
by: Steve Swift | last post by:
I have a page containing: <FORM NAME=radios> <INPUT TYPE=RADIO NAME=RAD VALUE=1 ID=RAD1> <LABEL FOR=RAD1>Check One</LABEL> <A onClick="document.radios.RAD.checked=false; return false">Uncheck...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.