A. Sinha
A. Sinha

Reputation: 2716

page redirection happening when Go button is pressed on a textbox (jquery/cordova)

I am working on a cordova app and using jquery mobile with cordova.

I have created a text field in the html page in the following manner:

<input type="email" id="email_id" name="email_id" maxlength="80" placeholder="[email protected]" style="height: 50px;" />

when I set focus on this field and press Go button (ASCII code = 13) from the mobile's keyboard, I am redirected to the login page of my application(which is also the 1st page of my app) and the page stack appears something like this:

0: Object
1: Object
2: Object
3: Object
hash: "#page_settings"
lastScroll: 156
pageUrl: "page_settings"
title: "Title"
transition: "none"
url: "file:///android_asset/www/index.html#page_settings"
__proto__: Object


4: Object
    hash: "#/android_asset/www/[email protected]"
    lastScroll: 0
    pageUrl: "/android_asset/www/[email protected]"
    title: "Title_new"
    transition: "fade"
    url: "file:///android_asset/www/[email protected]"
    __proto__: Object
    length: 5
    __proto__: Array[0]

4: Object is the object created after redirection and is different as compared to other objects like the Title is modified and the transition style is changed to fade from none.

Can any body please guide me why is it happening and how to fix it.

Upvotes: 1

Views: 56

Answers (2)

A. Sinha
A. Sinha

Reputation: 2716

Fixed the issue by adding onsubmit='return false;' to the form tag in the following manner:

<form onsubmit='return false;'></form>

Upvotes: 0

Andrew Berry
Andrew Berry

Reputation: 863

It sounds like the go button is performing a submit action. What are you expecting to happen when the person hits go?

Can you track what's happening by debugging your code?

Upvotes: 0

Related Questions