function setLoginToFocus(evt) {
var keyCode = evt.getKeyCode();
var comp = evt.getSource();
var enterButton = comp.findComponent('cb1');
if (keyCode == '13') {
enterButton.focus();
}
}
function blockNumbers(evt) {
var keyCode = evt.getKeyCode();
var isNumber = (keyCode > 47) && (keyCode < 58);
if (isNumber) {
evt.cancel();
}
}
function blockCharacters(evt) {
var keyCode = evt.getKeyCode();
var isCharacter = (((keyCode >= 65) && (keyCode <= 90)) || ((keyCode >= 97) && (keyCode <= 122)));
if (isCharacter) {
evt.cancel();
}
}
function onlyNumbers(evt) {
var keyCode = evt.getKeyCode();
var controlKeys = new Array(AdfKeyStroke.BACKSPACE_KEY, AdfKeyStroke.DELETE_KEY, AdfKeyStroke.TAB_KEY, AdfKeyStroke.HOME_KEY, AdfKeyStroke.END_KEY, AdfKeyStroke.ARROWLEFT_KEY, AdfKeyStroke.ARROWRIGHT_KEY, AdfKeyStroke.ENTER_KEY, AdfKeyStroke.ESC_KEY);
var isNumber = (keyCode > 47) && (keyCode < 58);
var isControlKey = false;
for (i in controlKeys) {
if (keyCode == controlKeys[i]) {
isControlKey = true;
break;
}
}
if (!(isNumber || isControlKey)) {
evt.cancel();
}
}
function onlyCharacters(evt) {
var keyCode = evt.getKeyCode();
var controlKeys = new Array(AdfKeyStroke.BACKSPACE_KEY, AdfKeyStroke.DELETE_KEY, AdfKeyStroke.TAB_KEY, AdfKeyStroke.HOME_KEY, AdfKeyStroke.END_KEY, AdfKeyStroke.ARROWLEFT_KEY, AdfKeyStroke.ARROWRIGHT_KEY, AdfKeyStroke.ENTER_KEY, AdfKeyStroke.ESC_KEY);
var isCharacter = (((keyCode >= 65) && (keyCode <= 90)) || ((keyCode >= 97) && (keyCode <= 122)));
var isControlKey = false;
for (i in controlKeys) {
if (keyCode == controlKeys[i]) {
isControlKey = true;
break;
}
}
if (!(isCharacter || isControlKey)) {
evt.cancel();
}
}
function convertToUppercase(evt) {
var comp = evt.getSource();
comp.setValue(comp.getSubmittedValue().toUpperCase());
}
No comments:
Post a Comment