Solved

Non submitting form

Posted on 2010-08-17
5
224 Views
Last Modified: 2013-11-19
On the right hand side, i have a form that is supposed to submit some data (see the picture upload form)

http://tinyurl.com/2827oon

any idea why this won't submit?
0
Comment
Question by:lvollmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:ploftin
ID: 33455997
Try replaceing your checkForm function with the one I attached.

Sincerely,
Philip Loftin
function checkForm(f) {
	// validate form first
    var result=autocheck(f);
    if(!result) return false;
    var err = '';

    var private = document.getElementById('verify_0');
	if((a5051c5b3e2ab952833c57e5e2e7250ef+adadc441098d2532ca90bb4f4641395f7!=private.value)) {
		err += 'Please enter the correct math answer for human verification\n\n';
	}

	var fld=document.getElementsByName("First");
	if(fld.value == '') {
		err += fieldname(fld) + ' is mandatory\n'; 
	}
	
	var fld=document.getElementsByName("Last");
	if(fld.value == '') {
		err += fieldname(fld) + ' is mandatory\n'; 
	}
	
	var fld=document.getElementsByName("Email");
	if(fld.value == '') {
		err += fieldname(fld) + ' is mandatory\n'; 
	}
	
	var fld=document.getElementsByName("Phone");
	if(fld.value == '') {
		err += fieldname(fld) + ' is mandatory\n'; 
	}
	
    if(err) {
		alert('Error!\n\n'+err+'\n\nPlease correct and try again.');
        return false;
    }
    return true;
}

Open in new window

0
 
LVL 3

Accepted Solution

by:
drcheap earned 500 total points
ID: 33456020
You have an error in your JavaScript field validation.

Line 312:
if((fld.type=='checkbox' && !fld.checked) || (fld.type!='checkbox' && (!fld || !fld.value))) err += fieldname(fld) + ' is mandatory\n';


This is trying to validate the "First name" field by using the following:
var fld=document.getElementsByName("First");

Your field is actually called "First name" as per this HTML:
<input name="First name" type="text" maxLength="20" mandatory="Y" value="First name"/>


Since you already have a reference to the form itself as "f" try using this instead:
var fld=f["First name"]


This same issue will come up with the Last name, Email, Phone, etc. fields as well.
0
 
LVL 3

Expert Comment

by:drcheap
ID: 33456025
I meant to have a semicolor on that line...

var fld=f["First name"];
0
 
LVL 1

Expert Comment

by:sahanz
ID: 33456113
In ur document take this function,

 function checkForm(f){
                // validate form first
                var result=autocheck(f);
                if(!result) return false;
                var err = '';
                var private = document.getElementById('verify_0');
if((a168ca2df08a8a9adc741f4b555ad049e+a9a723d7a69b1993837c87b0419ec2f9b!=private.value)) {
err += 'Please enter the correct math answer for human verification\n\n';
}
var fld=document.getElementsByName("First");
if(fld) {
 fld=fld[0];
if((fld.type=='checkbox' && !fld.checked) || (fld.type!='checkbox' && (!fld || !fld.value))) err += fieldname(fld) + ' is mandatory\n';
 
}
var fld=document.getElementsByName("Last");
if(fld) {
 fld=fld[0];
if((fld.type=='checkbox' && !fld.checked) || (fld.type!='checkbox' && (!fld || !fld.value))) err += fieldname(fld) + ' is mandatory\n';
 
}
var fld=document.getElementsByName("Email");
if(fld) {
 fld=fld[0];
if((fld.type=='checkbox' && !fld.checked) || (fld.type!='checkbox' && (!fld || !fld.value))) err += fieldname(fld) + ' is mandatory\n';
 
}
var fld=document.getElementsByName("Phone");
if(fld) {
 fld=fld[0];
if((fld.type=='checkbox' && !fld.checked) || (fld.type!='checkbox' && (!fld || !fld.value))) err += fieldname(fld) + ' is mandatory\n';
 
}
 
                if(err){
                    alert('Error!\n\n'+err+'\n\nPlease correct and try again.');
                    return false;
                }
                return true;
            }

instead of return true right before the last line try using.

document.forms["form_24"].submit();
0
 
LVL 1

Expert Comment

by:sahanz
ID: 33456124
also u can try adding the function to the submit button onClick,
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question