$(this.ids.create_user.add_user).show();
$(this.ids.create_user.newuser).focus();
}.bind(this));
- document.getElementById(this.ids.create_user.newuser).addEventListener('keypress', function(e) {
+ document.getElementById(this.ids.create_user.newuser).addEventListener('keydown', function(e) {
var target = e.target || e.srcElement;
if (e.keyCode == 13) {
- target.parentNode.getElementsByTagName('A')[0].click();
+ $(target.nextElementSibling).click();
+ } else if (e.keyCode == 27) {
+ this.cancelAddUser();
}
return false;
}.bind(this));
- document.getElementById(this.ids.create_user.newpwd).addEventListener('keypress', function(e) {
+ document.getElementById(this.ids.create_user.newpwd).addEventListener('keydown', function(e) {
var target = e.target || e.srcElement;
if (e.keyCode == 13) {
$(target.nextElementSibling).click();
+ } else if (e.keyCode == 27) {
+ this.cancelAddUser();
}
return false;
}.bind(this));
},
changePwd: function(el, user) {
var valid = true;
- var pwd = el.previousElementSibling.value;
+ var pwd = el.value;
if (this.pwdValidator(pwd) === false) {
alert(this.txt.invalid_pwd);
this.action_callback('chpwd', user, pwd);
}
},
- cancelAddUser: function(el) {
+ cancelAddUser: function() {
$(this.ids.create_user.add_user).hide();
},
cancelChangePwd: function(el) {
<%[ Change password ]%>
</a>
<span style="display: none;" rel="chpwd">
- <input type="password" onkeypress="event.keyCode == 13 ? $(this.nextElementSibling).click(): '';" />
- <a href="javascript:void(0)" onclick="Users.changePwd(this, '<%=$this->DataItem%>')">
+ <input type="password" onkeydown="event.keyCode == 13 ? Users.changePwd(this, '<%=$this->DataItem%>') : (event.keyCode == 27 ? Users.cancelChangePwd(this.nextElementSibling.nextElementSibling) : '');" />
+ <a href="javascript:void(0)" onclick="Users.changePwd(this.prevousElementSibling, '<%=$this->DataItem%>')">
<img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="<%[ Save ]%>" title="<%[ Save ]%>"/>
</a>
<a href="javascript:void(0)" onclick="Users.cancelChangePwd(this)">