javascript form authentication broken by other javascript

I have a website with a registration page. On this page, there's a form for creating a new account. When the form submits, a javascript checks all the fields and warns if there's a problem. The problem is, I had to add new javascript to do on the fly ajax address authentication, and now the form verification no longer works. I have to get these two pieces working together, but I don't understand how one can work and not the other, shouldn't they be breaking completely?

The website is:
http://www.repossession-leads.co.uk/index.php?main_page=login
// function call in form
onsubmit="return check_form(create_account);"

Open in new window

LVL 2
MeridianManagementAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MMDeveloperCommented:
the error is "form.state is undefined" which simply means that the form you are trying to control with that submit button code, doesn't have a field in it called "state".
0
MeridianManagementAuthor Commented:
Thanks MMDeveloper,

That sort of makes sense because that field doesn't exist until you lookup your postcode. However, if you click Enter Manually, the fields will appear including the one labeled "county" is actually "state".

So, how come after clicking "Enter Manually" does it still break? Why is it checking the status of "state" before posting?

Thank you.
0
MeridianManagementAuthor Commented:
How did you find out that error? I'm using firefox 3 and it doesn't show me any errors.
0
MeridianManagementAuthor Commented:
I couldn't determine the conflict so I created my own javascript code which worked fine.
function verify() {
var themessage = "You are required to complete the following fields: " + '\n\n';
if (document.forms['create_account'].firstname.value=="") {
themessage = themessage + " - First Name" + '\n';
}
if (document.forms['create_account'].lastname.value=="") {
themessage = themessage + " - Last Name" + '\n';
}
if (document.forms['create_account'].email_address.value=="") {
themessage = themessage + " - E-mail" + '\n';
}
if (document.forms['create_account'].password.value != document.forms['create_account'].confirmation.value) {
themessage = themessage + " - Passwords do not match" + '\n';
}
 
 
// radio buttons
 
myOption = -1;
for (i=document.forms['create_account'].gender.length-1; i > -1; i--) 
{
	if (document.forms['create_account'].gender[i].checked) {
		myOption = i; i = -1;
	}
}
if (myOption == -1) {
	themessage = themessage + " - Gender" + '\n';
}
 
 
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: " + '\n\n') {
document.forms['create_account'].submit();
}
else {
alert(themessage);
return false;
   }
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MMDeveloperCommented:
sorry for not responding, was pulled into a few meetings... I used the built-in "Error Console" under the "Tools" menu in FF. You can also use the 3rd party Firebug extension for more detailed information; however usually the Error Console is sufficient.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.