Textbox focus event does not work, x value is correct, but component does not change its value, any hint, please.
$(document).ready(function () {
$('#txtSchool').textbox('textbox').bind('keypress focus blur', function (e) {
CallEvents($(this), e);})
});
function CallEvents(Sender, e) {
if (e.type == 'focus') {
var rd = $(Sender).prop('readonly');
var rd = false; //testing...
if (!rd) {
var q = String($(Sender).val());
var x = q.replace(/\./g, "a"); //replacing dot by a
//$.messager.alert('SCObraNet', 'focus ' + x, 'info');
$(Sender).val(x); //não preenche o campo solicitado com o conteúdo x
return;
}
}
else if (e.type == 'keypress') {
//$.messager.alert('SCObraNet', 'keypress ', 'info');
}
else if (e.type == 'blur') {
//$.messager.alert('SCObraNet', 'blur', 'info');
}
};
</script>
I tested it in other ways and nothing, for example
$('#txt').textbox('textbox').on('focus', function () {
$(this).val("00000"); //don't set
});
or
$('#txt').textbox('textbox').bind('focus', function () {
$(this).val("00000"); //don't set
});
or
$('#txt').textbox('textbox').bind('focusin', function () {
$(this).val("00000"); //don't set
});