Solved

Non submitting form

Posted on 2010-08-17
5
216 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now