vaindil
vaindil

Reputation: 7864

Cannot submit form from linked page in jQuery Mobile

I am trying to submit a form using jQuery Mobile, but if the form is on a linked page it will not submit. For example, my home page is mysite.com/page.html. If I put the form code on that page, the form submits perfectly. If I put the form on a different data-role="page" in the same file, the page's link becomes mysite.com/#reg and the submit button stops working entirely. I am using jQuery 1.8.3 and jQuery Mobile 1.2.0.

Here's a jsFiddle with the form only on the Registration page. You'll notice that it doesn't do anything when submit is clicked. Here's that exact same code, just with the form copy-pasted onto the main page. When submit is clicked on this one, a loading screen is given (meaning it's trying to submit but it's not finding my validation script).

Upvotes: 0

Views: 291

Answers (1)

Bernie
Bernie

Reputation: 5055

You forgot to close your first form tag. After repair everything's working as expected.

Placed a fixed version here:

<form action="login.php" method="POST">
    <a href="#index" data-role="button" data-transition="slide" data-direction="reverse">
        Return to home page
    </a>
<!-- The closing form tag -->
</form>

http://jsfiddle.net/JVXEa/

Upvotes: 1

Related Questions