extjs - 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>     }); </script> 

these days better use defaultbutton property on form designate default button on form. button who's handler handle enter key.:

http://docs.sencha.com/extjs/6.0/6.0.2-classic/#!/api/ext.panel.panel-cfg-defaultbutton


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -