I got a problem. My form Validation isn’t working. Actually to be more accurate, the chEmail function works but I also need Flash to check the input fields “first” and “last” to make sure something is entered in there? Am I missing something here or done something wrong? Thanks peeps
Here’s the code related to the validation
function ckName(){
if (formData.first == “”){
errBox.setMessage(“Oop’s, you forgot to fill in your first name”);
return false; }
else {
return true};
}
function ckName(){
if (formData.last == “”){
errBox.setMessage(“Oop’s, you forgot to fill in your last name”);
return false; }
else {
return true};
}
function ckEmail(){
if(formData.submit_by == “”){
errBox.setMessage(“You Must Fill In Your Email Address”);
return false;}
else{
if(formData.submit_by.indexOf(".",0)==-1 || formData.submit_by.indexOf("@",0)==-1){
errBox.setMessage(“Your Email Address Is Not In Correct Form”);
return false;}
else{
return true;}
}
a very common mistake, an empty textfield is totally empty in the beginning. That means there is no string in it, not even “”. Put into your first frame the actions:
Seticus, my code is already on the first frame so where would I place the code u gave me?
Digitalosophy, its not working. I’m 100% sure I did it wrong. LOL HELP!
function ckName(){
if (!first.length){
errBox.setMessage(“Oop’s, you forgot to fill in your first name”);
return false; }
else {
return true};
}
function ckName(){
if (!last.length){
errBox.setMessage(“Oop’s, you forgot to fill in your last name”);
return false; }
else {
return true};
}
function ckEmail(){
if(formData.submit_by == “”){
errBox.setMessage(“You Must Fill In Your Email Address”);
return false;}
else{
if(formData.submit_by.indexOf(".",0)==-1 || formData.submit_by.indexOf("@",0)==-1){
errBox.setMessage(“Your Email Address Is Not In Correct Form”);
return false;}
else{
return true;}
}
function ckName(){
if (formData.first == “”){
errBox.setMessage(“Oop’s, you forgot to fill in your first name”);
return false; }
else {
return true};
}
function ckName(){
if (formData.last == “”){
errBox.setMessage(“Oop’s, you forgot to fill in your last name”);
return false; }
else {
return true};
}
function ckEmail(){
if(formData.submit_by == “”){
errBox.setMessage(“You Must Fill In Your Email Address”);
return false;}
else{
if(formData.submit_by.indexOf(".",0)==-1 || formData.submit_by.indexOf("@",0)==-1){
errBox.setMessage(“Your Email Address Is Not In Correct Form”);
return false;}
else{
return true;}
}