I can't seem to set focus on my WebMaskEditor. I am using Javascript to test the length of the value,
set focus back if length is incorrect. Using Valuechanged event to execute the following
function AcctNumValidation() {
// var acctNum = MasterForm.MainContent_WQWebGroupBox_WQedittxtAcctNum.value;
// if (acctNum.length == 0 || acctNum.length == 7 ) {
// MasterForm.MainContent_WQWebGroupBox_WQtxtValMsg.value = "";
// return true;
// }
// else {
// MasterForm.MainContent_WQWebGroupBox_WQtxtValMsg.value = "Account # must be 7 digits";
// MasterForm.MainContent_WQWebGroupBox_WQedittxtAcctNum.focus();
// return false;
Thanks Dan
Hi Dan,
Usage of explicit attributes of html elements is not supported by editors. You need to use member methods. Something, like below.var editor = $find("WebMaskEditor1");//var editor = $find("<%=WebMaskEditor1.ClientID%>");var value = editor.get_value();var text = editor.get_text();...
If editor does not have focus and you need to get value/text in focused state, then it is not simple and can be rather tricky. You may call editor.setFocus(); method, but browser will set actual focus with a delay. So, you need a handler for the focus event of browser (or ClientEvents.Focus or editor), or at least create a delay/setTimeout, or similar. Only within that event/delay, you may get focused value.