oracleguy
12-10-2002, 05:12 AM
I'm getting this error: connot assign to a function result
My code:
function SendOrder_onclick() {
//Validate customer information
if (document.Order.CustName.value=="")
{
alert("You must enter your name")
return false
}
var email = document.Order.CustEmail.value
if (email.length<5)
{
alert("You must enter a valid email address.")
return false
}
//if (email.match("@")!="")
// {
// alert("You must enter a valid email address.")
// return false
// }
if (email.match("orangepc.net")="orangepc.net")
{
alert("That is a restricted domain. Please enter a diffrent email adress")
return false
}
alert("All fields validated.")
return true
}
Here is the button code:
<INPUT type="button" Value="Send Order" name="SendOrder" onclick="SendOrder_onclick()">
I know I'm doing something wrong but what. Basically what I want the js function to do is to validate my form elements so i don't have to write as much server side stuff. And if it hits an error to alert the user then exit the function.
Thanks.
My code:
function SendOrder_onclick() {
//Validate customer information
if (document.Order.CustName.value=="")
{
alert("You must enter your name")
return false
}
var email = document.Order.CustEmail.value
if (email.length<5)
{
alert("You must enter a valid email address.")
return false
}
//if (email.match("@")!="")
// {
// alert("You must enter a valid email address.")
// return false
// }
if (email.match("orangepc.net")="orangepc.net")
{
alert("That is a restricted domain. Please enter a diffrent email adress")
return false
}
alert("All fields validated.")
return true
}
Here is the button code:
<INPUT type="button" Value="Send Order" name="SendOrder" onclick="SendOrder_onclick()">
I know I'm doing something wrong but what. Basically what I want the js function to do is to validate my form elements so i don't have to write as much server side stuff. And if it hits an error to alert the user then exit the function.
Thanks.