Occurs when a field has been modified, the field loses focus (for example, the user presses Enter, Tab, or an arrow key or clicks the mouse on another field in the DataWindow), and the data in the field does not pass the validation rules for its column.
Argument |
Description |
---|---|
sender |
String. Identifier for the client-side control. |
row |
Number. The number of the row containing the item whose new value has failed validation. |
columnName |
String. The name of the column containing the item. |
newValue |
String. The new data the user has specified for the item. |
Web DataWindow client control
Set the return code to affect the outcome of the event:
0 (Default) Reject the data value and show an error message box
1 Reject the data value with no message box
2 Accept the data value
3 Reject the data value but allow focus to change
If the Return code is 0 or 1 (rejecting the data), the field with the incorrect data regains the focus.
The ItemError event occurs instead of the ItemChanged event when the new data value fails a validation rule. You can force the ItemError event to occur by rejecting the value in the ItemChanged event.
Postback calls to the server-side ItemError event Default postback scripts for this event are called only after an ItemFocusChanged event occurs on the client side. The default event handlers that invoke the server-side ItemError event are PBDataWindow_ItemFocusChanged_AND_ItemError and PBDataWindow_ItemFocusChanged_AND_ItemChanged_OR_ItemError. The default event handler PBDataWindow_ItemError does not cause a postback, but instead rejects the value entered by the user.
This script in the .aspx file displays an alert message:
function objwdw_ItemError(sender, rowNumber, columnName, newValue) { alert("ItemError: " + rowNumber + columnName + newValue); }