Client Side Events
The following are client-side events supported by the WebTextEditor control.
Client Side Events Properties
Initialize |
Event fired when the WebTextEdit was initialized. It can be used to customize its appearance and behavior. Notes: This event cannot be canceled.
Parameters oEdit
Reference to the JavaScript object that represents WebTextEdit. Remarks
The following example shows the event being used. function initializeInEdit(oEdit)
{
alert("Init Edit: " + oEdit.ID);
} |
ValueChange |
Event fired when control loses the input focus and new value in control is defferent from old value (before focus was set). Notes: This event can be canceled. If event is canceled, then old value is restored.
Parameters oEdit
Reference to the JavaScript object that represents WebTextEdit. oldValueOld value oEventReference to the ig_EventObject object. Remarks
The following example shows the event being used. function valueChangeInEdit(oEdit, oldValue, oEvent)
{
if(oldValue == "ok" && oEdit.getValue() == "")
// restore old value oEvent.cancel = true;
// trigger postback of page
if(oEdit.getText() == "post me to server")
oEvent.needPostBack = true;
} |
TextChanged |
Event fired on every change in the text that appears in the input field. It can be keypress, spin, etc. Notes: This event can not be canceled.
Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. oldValueold value oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. function textChangedInEdit(oEdit, newText, oEvent)
{
status = oEdit.ID + " text:" + newText;
// trigger postback of page
if(newText == "ok")
oEvent.needPostBack = true;
} |
InvalidValue |
Event fired when control loses the input focus and new value in control is invalid. Notes: This event can be canceled. If event is canceled, then possible InvalidValue handler on the server is not notified.
Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. fieldscontainer of extra parameters related to invalid value. They are different for every particular control: see examples below. oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. // example to process invalid value in WebNumericEdit
function invalidValueInNumericEdit(oEdit, fields, oEvent)
{
var instantText = fields.text;
var suggestedValue = fields.value;
var typeOfInvalidText = fields.type;
if(typeOfInvalidText == 0)
alert("String can not be converted +
to a number. +
Null or 0 is used.");
if(typeOfInvalidText == 1)
alert("New value is out of +
Min/Max range of numbers. +
Min or max value is used.");
if(typeOfInvalidText == 2)
alert("Empty string was entered +
while null is not +
allowed. Value of 0 is used.");
// prevent firing InvalidValue event
// on server except for range error
if(typeOfInvalidText != 1)
oEvent.cancel = true;
}
// example to process invalid value in WebDateTimeEdit
function invalidValueInDateTimeEdit(oEdit, fields, oEvent)
{
var instantYear = fields.year;
var instantMonth = fields.month;
var instantDay = fields.day;
var instantHours = fields.hours;
var instantMinutes = fields.minutes;
var instantSeconds = fields.seconds;
var instantMilliseconds = fields.milliseconds;
var suggestedDate = fields.date;
var typeOfInvalidText = fields.type;
if(typeOfInvalidText == 0)
alert("String can not be +
converted to a date. +
Last good value is used.");
if(typeOfInvalidText == 1)
alert("New value is out of +
Min/Max range of dates. +
Min or max value is used.");
if(typeOfInvalidText == 2)
alert("1 or more field +
have invalid values.");
}
// example to process invalid value in WebMaskEdit
function invalidValueInNumericEdit(oEdit, fields, oEvent)
{
var instantText = fields;
alert("Not all required mask +
positions are filled.");
}
|
CustomButtonPress |
Event fired when custom button was pressed. Notes: This event can not be canceled.
Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. texttext value oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. function focusInEdit(oEdit, text, oEvent)
{
status = "Focus in " + oEdit.ID;
}
|
Focus |
Event fired when control gets input focus, but before it adjusts internal variables and builds the focus-state text. Notes: This event can not be canceled.
Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. texttext value oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. function textChangedInEdit(oEdit, newText, oEvent)
{
status = oEdit.ID + " text:" + newText;
// trigger postback of page
if(newText == "ok")
oEvent.needPostBack = true;
} |
Blur |
Event fired when control loses input focus, but before it adjusts internal variables and builds the no-focus-state text. Notes: This event can not be canceled.
Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. texttext value oEventreference to the ig_EventObject object. |
MouseDown |
Event fired when control receives "mousedown" event of a browser over the input-field. Notes: This event can not be canceled. This event is not fired when a button gets mousedown event.
Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. texttext value oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. function mouseDownInEdit(oEdit, text, oEvent)
{
status = "MouseDown in:" +
oEdit.ID + ", mouse-button:" +
oEvent.event.button;
}
|
KeyDown |
Event fired when control receives the "keydown" event of a browser, but before it starts to process it. Notes:1. This event can be canceled.
2. If event is canceled, then control ignored that keyboard entry. 3. If it is a character entry, then the value of the keyCode parameter may not match with the actual keyCode of that character. To process characters,- the KeyPress event should be used. Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. keyCodeinteger that equals to the key-code of keyboard entry which is supplied by a browser oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. function keyDownInEdit(oEdit, keyCode, oEvent)
{
// ignore the Space key
if(keyCode == 32)
oEvent.cancel = true;
// trigger postback of page on Escape key
if(keyCode == 27)
oEvent.needPostBack = true;
}
|
KeyPress |
Event fired when control receives the "keypress" event of a browser, but before it starts to process it. Notes:1. This event can be canceled.
2. If event is canceled, then control ignored that keyboard entry. 3. If event is not canceled, then the original keyCode can be modified and in this case the control will use that new value instead of original one. In order to do that, the "oEvent.keyCode" variable should be set to new value. 4. The keypress event is fired only when a particular character is entered compare to any keyboard key in case of the keydown event. Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. keyCodeinteger that equals to the key-code of keyboard entry which is supplied by a browser oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. function keyPressInEdit(oEdit, keyCode, oEvent)
{
// ignore the "0" character
if(keyCode == 48)
oEvent.cancel = true;
// ignore the "A" and "a" characters
if(keyCode == 65 || keyCode == 97)
oEvent.cancel = true;
// if the "b" was entered,
// then replace it by the "B"
if(keyCode == 98)
oEvent.keyCode = 66;
}
|
Spin |
Event fired before value is incremented or decremented by a spin button or by up/down arrow key. Notes:This event can be canceled. If event is canceled, then value in control stays the same.
Parameters oEdit
reference to the JavaScript object that represents WebTextEdit. deltanumeric value that is used to perform the "+=" operation with the current value in control. It can be positive or negative depending on the incerement or decrement. oEventreference to the ig_EventObject object. Remarks
The following example shows the event being used. function spinInCurrency(oEdit, delta, oEvent)
{
if(oEdit.getValue() > 1000 && delta > 0)
oEvent.cancel = true;
status = "Spin. OldValue:" + oEdit.getValue() +
", delta:" + delta;
}
|
