Validate form with Javascript

Hi,All detailed help are appreciated…

I have a web form that requires validation in almost every field.

Case 1;

Insure that all field are not empty.

Text

Combobox

Radiobutton

date

email

Case 2;

a text field that have to be validated depending on which selected choice in a radio button field.

IF radiobutton = “A” then field “TEXT” have to be filled.

Case 3;

A checkbox with 25values and the user has to choose up to 3 choices and it’s a mandatory field.

alert (“U have 2 choose up to 3 alternatives”)

My question is how to include all this variant in one code?

//Rebecka

Subject: Validate form with Javascript

I use this as a resource for Domino/Javascript: http://codestore.net/ , poke around for JS Validation examples

Subject: RE: Validate form with Javascript

Thanks! But I’m a really “newbe” in implementing javascript code i Notes applications.I need more detailed instruction…

//Rebecka

Subject: RE: Validate form with Javascript

There are good javascript tutorials on this site

http://codepunk.hardwar.org.uk/ajs.htm

You will find everything you need on how to validate all the different field types.

Subject: RE: Validate form with Javascript

Here is a quick schooling on HTML Radio Buttons… You can use similar code (not the same) for combos or lists…

{Radio Button Code}

questionoption = -1;

for (i=0;i<document.forms[0].Ques4B.length;i++)

{



 if (document.forms[0].Ques4B[i].checked) 

	{

	user_input = document.forms[0].Ques4B[i].value;

	questionoption = i;

	}

}

if ( questionoption == -1 )

{

alert("Please Make a Selection for Question 4b.");

return false;

}

{Field Code}

if (document.forms[0].Ques4B.value == null)

{

alert("Please Make a Selection for Question 4b.");

return false;

}

Check out the links that the prior posters provided… That is how most of us re-learned/learned Java…