You need to write this function in the inline JS -
this.validateText = function(value){
var textView = this.ui.get("Text1");
var regExp = /^\d{4}$/;
if(value){
if(!regExp.test(value)){
textView.setValid(false, "Please enter 4 numbers");
}else{
textView.setValid(true);
}
}
}
Then call it from the on blur event of the textbox, like -
view.validateText(me.getData());
Hope this helps.
------------------------------
Atanu Roy
Solution Architect
Salient Process
------------------------------