movieprodw
asked on
javascript, onsubmit return
Hello,
I have the below functions and I want to add them into one function, onsubmit check form the if true then activate div.
Thanks for any help.
I have the below functions and I want to add them into one function, onsubmit check form the if true then activate div.
Thanks for any help.
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
if (form.userId.value == "" || form.firstname.value == "" || form.lastname.value == "" || form.phonenumber.value == "" || form.price.value == "" || form.zip.value == "" || form.title.value == "" || form.build_year.value == "" || form.sq_ft.value == "" || form.prop_desc.value == "") {
alert( "Please complete all of the required* fields." );
return false ;
}
// ** END **
return true ;
}
//-->
</script>
<script type="text/javascript">
function onSubmitButton(){
document.getElementById("submitButtonDiv").style.display = "none";
if (navigator.appName == "Microsoft Internet Explorer") {
document.getElementById("progressBar").innerHTML = "";
document.getElementById("progressBar").style.display = "block";
document.getElementById("progressBar").innerHTML = "<img src='/img/ajax-loader.gif' alt='Progress Bar'>";
} else {
document.getElementById("progressBar").style.display = "block";
}
}
</script>
ASKER
That did check the info but did not make the second function work.
Here is what I have for the form
<form action="./processlisting.p hp" method="post" enctype="multipart/form-da ta" onSubmit="return checkform(this)">
Here is what I have for the form
<form action="./processlisting.p
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
how do you call this function? onSubmitButton
is there a button that calls this? if yes post the code...
is there a button that calls this? if yes post the code...
ASKER
Thank you
ASKER
NOTE that the correct answer has an error:
}
}
</script>
should be
}
}
-->
</script>
}
}
</script>
should be
}
}
-->
</script>
Open in new window