I'm trying to add validation to my edittext controls. I need to make sure they are always numeric values. I've seen a number of posts indicating various methods for accomplishing this, but my edittext control is always returning an 'undefined' value regardless of whether I add a number or a letter. I can see the correct value in the debugger's view of the control, but the code fails. Can anyone please tell me what I'm doing wrong here?
CreateDialog.prototype.run = function()
{
// declare a bunch of vars
// Create a window of type palette.
var win = new Window("dialog", "Element Spray Generator",[iTop,iLeft,iTop + iWidth,iLeft + iHeight] ); // bounds = [left, top, right, bottom]
this.windowRef = win;
// add a bunch of other stuff...
win.txtEditScaleJitter = win.btnPanel.add("edittext",[win.btnPanel.bounds.width/5*4-iPadding, win.txtScaleJitter.bounds.top, win.btnPanel.bounds.width-iPadding, win.txtScaleJitter.bounds.bottom], "100%")
//Textbox events
win.txtEditScaleJitter.onChanging = function() {
//**** here win.txtEditScaleJitter.text is always undefined ******
var testCharacter = win.txtEditScaleJitter.text.charAt(win.txtEditScaleJitter.text.length -1);
switch(testCharacter ){
case "0": case "1": case "2": case "3":case "4": case "5":case "6":case "7":case "8": case "9": break;
default: alert("You entered a character that is not a number --> " + testCharacter + " <--"); break;
}
};
// Display the window
win.show();
return true;
}