当在文本框上按下Go按钮时发生页面重定向(jquery / cordova) [英] page redirection happening when Go button is pressed on a textbox (jquery/cordova)
问题描述
我正在使用cordova应用程式,并使用带cordova的jquery mobile。
我以下列方式在html网页中建立了一个文字栏位:
< input type =emailid =email_idname =email_idmaxlength =80placeholder =email @ doamin .comstyle =height:50px; />
当我将焦点置于此字段并从移动设备的键盘上按Go按钮(ASCII代码= 13) ,我被重定向到我的应用程序的登录页面(这也是我的应用程序的第一页),页面堆栈看起来像这样:
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/index.html?textbox_email=ffffg@hh.com
lastScroll:0
pageUrl:/android_asset/www/index.html?textbox_email=ffffg@hh.com
title:Title_new
transition:fade
url:file: ///android_asset/www/index.html?textbox_email=ffffg@hh.com
__proto__:Object
length:5
__proto__:Array [0]
4:Object
是重定向后创建的对象,其他对象(例如Title)已修改,转换样式从无
更改为 fade
。
任何机构都可以指导我为什么会发生和如何修复它。通过以下列方式将onsubmit ='return false;'添加到表单标记来修复此问题:
< form onsubmit = 'return false;'>< / form>
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@doamin.com" 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/index.html?textbox_email=ffffg@hh.com"
lastScroll: 0
pageUrl: "/android_asset/www/index.html?textbox_email=ffffg@hh.com"
title: "Title_new"
transition: "fade"
url: "file:///android_asset/www/index.html?textbox_email=ffffg@hh.com"
__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.
Fixed the issue by adding onsubmit='return false;' to the form tag in the following manner:
<form onsubmit='return false;'></form>
这篇关于当在文本框上按下Go按钮时发生页面重定向(jquery / cordova)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!