GeekedOut
GeekedOut

Reputation: 17185

Submitting form after fixing validation errors doesnt work

I have this test page I am working from: http://www.problemio.com/test.php

The problem happens when you click "Click To Test Signup" and press submit without entering any data into the form.

It will give you errors that the form can't be empty. So you put any values into the form, and press submit again. The error happens at that point. The submit code in jQuery does not seem to be getting called for some reason. Any idea why that might happen?

Thanks!!

Upvotes: 0

Views: 172

Answers (1)

Jose Vega
Jose Vega

Reputation: 10258

Here is what I found from looking at the source of your code:

The HTML

<label for="name"><span>Last Name (Optional): </span></label> <input type="text" name="last_name"/> 

The JS

var last_name = $("#last_name").val();

What you are referencing is not the content of the input field, you are referencing an element with the id of last_name, the content in the input field is referenced by:

var last_name = $('input[name="last_name"]').val();

Upvotes: 2

Related Questions