Validating form by exact words

Hi guys, I am working on a distance learning system for my school, it will look like this:
User will be entering words in blanks as he listen to audio file. I have a problem finding validating script (javascript) that will check entered results.
The script should trigger when user is done filling blanks and pressed “submit” button. So far I’ve found a couple scripts that seem to be able to do that, but I don’t know how to tune them up for my specific task.

Here is what I’ve got:

f = element
if ( f.value fails ) {
alert(“Error …”)
return false }

that’s using regular expressions, but maybe there is another way? or how do I get this script to work.

Thank you very much!!!

ehhhmmmm if I understand correctly then you could try

function FormSubmit(){

f = self.textbox.value;
if (f == “whatever”)
{ alert(“Pass”) }
{ alert(“Fail”); }


and then in the form action you declare

form action=“JavaScript: FormSubmit()”

does this help :huh:

or may be you can create an array that contains all the correnct values in order like this:

corrects = [“hello”,“yes”,etc];
//and check all the text fields with one function:

function validate(){

for(i=0;i <corrects.length;++i){ 

if(corrects*!=document.yourForm.elements*.value){ return (false);
return (true);

Hi Dulcinea, thanks for your and “RadBell’s” help. How do you create an array? Could you also show me how to assign a function to each text field?