Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Non submitting form

Posted on 2010-08-17
5
Medium Priority
?
230 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

609 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