# Connecting javascript's

**URL:** <https://forum.kirupa.com/t/connecting-javascripts/61970>\
**Category:** Uncategorized\
**Created:** [August 23, 2004, 7:55pm UTC](https://forum.kirupa.com/t/connecting-javascripts/61970 "2004-08-23T19:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Grinch](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@Adam\_Grinch](https://forum.kirupa.com/u/Adam_Grinch)\
**Post date:** [August 23, 2004, 7:55pm UTC](https://forum.kirupa.com/t/connecting-javascripts/61970/1 "2004-08-23T19:55:22Z")

</div>

Hi everybody, I am still working on a form that suppose to validate it self and proceed only if all that text fields are filled with the correct words. [here](http://dsbc.edu/distance/biblical_intro/biblical_intro_1A.htm) is what I am working on. I ve got two scripts that kirupa forum members gave me, but I don’t know how to connect them to a form and make everything work  
here are java scripts:

```auto
function FormSubmit(){

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

}

and then in the form action you declare 

form action="javascript: FormSubmit()"

```

and another array:

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);  
break;}  
return (true);  
document.yourForm.submit();}}

Can anyone help?!!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 24, 2004, 7:58am UTC](https://forum.kirupa.com/t/connecting-javascripts/61970/2 "2004-08-24T07:58:43Z")

</div>

try something like this

form action=“Submitform()”

and then

function Submitform(){  
validate = ValidateForm()  
if (validate == “true”)  
{form.action = “anotherpage.html”  
form.submit();}  
else  
{ alert(“ERROR”);}  
}

function validate(){

}

now in validate you have your validation code and then try when your happy with the fields you’ve validated you put

validate = “true” or “false”

then in the other function the validate field takes the value you’ve returned from the other function…I think

this is from memory and if it doesn’t work, sorry. Any problems try [www.w3schools.com](http://www.w3schools.com) they usually have all the answers :thumb:
