Click here to Skip to main content
15,891,513 members
Home / Discussions / Web Development
   

Web Development

 
QuestionStrange HTML nested table problem Pin
Hemant Mane4-Oct-06 22:27
Hemant Mane4-Oct-06 22:27 
AnswerRe: Strange HTML nested table problem Pin
Paeth.Claudius-Raphael4-Oct-06 23:45
Paeth.Claudius-Raphael4-Oct-06 23:45 
GeneralRe: Strange HTML nested table problem Pin
Hemant Mane5-Oct-06 0:27
Hemant Mane5-Oct-06 0:27 
GeneralRe: Strange HTML nested table problem Pin
Paeth.Claudius-Raphael5-Oct-06 0:43
Paeth.Claudius-Raphael5-Oct-06 0:43 
GeneralRe: Strange HTML nested table problem Pin
Hemant Mane5-Oct-06 0:54
Hemant Mane5-Oct-06 0:54 
QuestionEvent: when the txt value changed Pin
militiaware4-Oct-06 22:27
militiaware4-Oct-06 22:27 
AnswerRe: Event: when the txt value changed Pin
led mike5-Oct-06 4:57
led mike5-Oct-06 4:57 
QuestionForm validation - form.length Pin
braveheartkenya4-Oct-06 16:52
braveheartkenya4-Oct-06 16:52 
Greetings all!

I'm quite new to javascript so i may have some rather silly kind of questions... but anyway here's the problem...

I want to loop through all the elements in a form so as to check their values in order to validate the relevant fields, i thought i could get the number of form objects within the form using "formName.length." Then use a loop to go through all the form fields.

It seems formName.length is not working for me ... it's returning "undefined" or "0" values. How could i get the number of form objects within a certain form.

My code is as follows:

[CODE]
window.moveTo(100,100);
window.resizeTo(300,460);
//window.locationbar.visible=false;
//window.menubar.visible=false;
//window.personalbar.visible=false;
//window.scrollbars.visible=false;
//window.statusbar.visible=false;
//window.toolbar.visible=false;
//window.resize=false;
//window.resizeable=no;

var elementNo;

elementNo = document.registrationForm.length;
//elementNo = document.registrationForm.txtFirstName.value;
var num;
num = document.forms[0].length;
var counter = 0;
var myMessage = "Please ensure that you have filled in the following fields:\n";
var myFieldsAlert = "";
var myAlertFlag="0";
function validate(){
//
alert("abc "+elementNo);
alert("abc "+num);
/**/
while(counter<elementNo){
//
if(registrationForm.elements[counter].value==""){
myFieldsAlert += "-"+registrationForm.elements[counter].id+"\n";
myAlertFlag="1";
}

if(registrationForm.optGenderM.value!="0" || registrationForm.optGenderF.value!="1"){
myFieldsAlert += "-Gender\n";
myAlertFlag="1";
}
counter++;
}
/**/
/**/
if(myAlertFlag=="1"){
alert(myMessaage+myFieldsAlert);
}
else{
registrationForm.submit();
}

myAlertFlag ="0";
/**/
return false;
}
[/CODE]
Could someone please enlighten me on the issue at hand and propose a solution. (By the way the code is in a HTML page which is called up as a popup).

Any help would be greatly appreciated...
QuestionAuthentication & authorization issue for IIS Pin
Elena_2006oct4-Oct-06 2:33
Elena_2006oct4-Oct-06 2:33 
AnswerRe: Authentication & authorization issue for IIS Pin
aamironline4-Oct-06 5:54
aamironline4-Oct-06 5:54 
QuestionHow to read and write image from MS Access database? (OLE Object) [modified] Pin
Richard Htin3-Oct-06 20:55
Richard Htin3-Oct-06 20:55 
AnswerRe: How to read and write image from MS Access database? (OLE Object) Pin
Sam Heller5-Oct-06 2:50
Sam Heller5-Oct-06 2:50 
GeneralRe: How to read and write image from MS Access database? (OLE Object) Pin
Dennis Jeffrey7-Oct-06 5:06
Dennis Jeffrey7-Oct-06 5:06 
GeneralRe: How to read and write image from MS Access database? (OLE Object) Pin
Sam Heller7-Oct-06 5:55
Sam Heller7-Oct-06 5:55 
GeneralRe: How to read and write image from MS Access database? (OLE Object) Pin
Dennis Jeffrey7-Oct-06 6:04
Dennis Jeffrey7-Oct-06 6:04 
QuestionCustomize button action in IE Pin
mfranco_neto3-Oct-06 8:51
mfranco_neto3-Oct-06 8:51 
AnswerRe: Customize button action in IE Pin
Bradml3-Oct-06 17:37
Bradml3-Oct-06 17:37 
QuestionJavaScript code coverage Pin
Paul Watson3-Oct-06 4:09
sitebuilderPaul Watson3-Oct-06 4:09 
AnswerRe: JavaScript code coverage Pin
Paeth.Claudius-Raphael5-Oct-06 0:07
Paeth.Claudius-Raphael5-Oct-06 0:07 
GeneralRe: JavaScript code coverage Pin
Paul Watson5-Oct-06 3:04
sitebuilderPaul Watson5-Oct-06 3:04 
GeneralRe: JavaScript code coverage Pin
Paeth.Claudius-Raphael5-Oct-06 14:37
Paeth.Claudius-Raphael5-Oct-06 14:37 
GeneralRe: JavaScript code coverage Pin
Paul Watson5-Oct-06 22:27
sitebuilderPaul Watson5-Oct-06 22:27 
GeneralRe: JavaScript code coverage Pin
Paeth.Claudius-Raphael6-Oct-06 5:18
Paeth.Claudius-Raphael6-Oct-06 5:18 
GeneralRe: JavaScript code coverage Pin
Paul Watson6-Oct-06 5:59
sitebuilderPaul Watson6-Oct-06 5:59 
GeneralRe: JavaScript code coverage Pin
Paeth.Claudius-Raphael6-Oct-06 9:29
Paeth.Claudius-Raphael6-Oct-06 9:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.