javascript - submit form on ENTER press int EXT js -
i new ext.js; need submit form when enter pressed below code dont know call in listener of password field here code: ie:what function call in listener
<script type="text/javascript"> ext.onready(function() { ext.tip.quicktipmanager.init(); ext.create("ext.container.viewport", { layout: "border", rtl: <spring:theme code='theme.rtl' text='false' /> }); ext.create("ext.window.window", { title: "<spring:message code='title.login' text='login' />", height: 310, width: 450, closable: false, layout: "border", items: [{ xtype: "panel", border: false, bodycls: "login-header", height: 160, region: "north" }, { id: "<%=loginformid%>", url: "<spring:url value='/secure/auth'/>", xtype: "form", layout: "form", region: "center", bodypadding: 10, border: false, buttons: [{ handler: function() { var form = this.up("form").getform(); if (form.isvalid()) { ext.getcmp("<%=submitbtnid%>").disable(); form.standardsubmit = true; form.method = "post"; form.submit(); } }, id: "<%=submitbtnid%>", text: "<spring:message code='button.submit' text='submit' />" }, { handler: function() { var form = this.up("form").getform(); form.reset(); }, id: "<%=clearbtnid%>", text: "<spring:message code='button.clear' text='clear' />" }], defaulttype: "textfield", defaults: { msgtarget: "side", labelwidth: 100 }, items: [{ fieldlabel: "<spring:message code='input.username' text='username' />", name: "selfcare_username" }, { fieldlabel: "<spring:message code='input.password' text='password' />", name: "selfcare_password", enablekeyevents:true, inputtype: "password", listeners: { scope: this, specialkey: function(f, e) { if (e.getkey() === e.enter) { } } } }] }] }).show(); <c:if test="${not empty param.error}"> var errormsg = "<c:out value="${spring_security_last_exception.message}" />"; if (errormsg !== "") { ext.messagebox.show({ title: "<spring:message code='title.error' text='error' />", msg: errormsg, closable: false, buttons: ext.msg.ok }); } </c:if> });
this listener do:
listeners: { keypress: function(textfield, e, options) { if (e.keycode === 13) { var form = this.up("form").getform(); if (form.isvalid()) { ext.getcmp("<%=submitbtnid%>").disable(); form.standardsubmit = true; form.method = "post"; form.submit(); } } } }
Comments
Post a Comment