Avoiding "Double" Error Messages in DW Validation
										Posted In: 
										
DataWindow
. 
 
									By popo
A common problem when setting up validation logic in ItemChanged is that two message get
displayed. First, the intended message in ItemChanged and then a default PowerBuilder message:
"Item '[value]' does not pass validation test". One simple solution to avoid this problem is to
have descendents set a flag (ib_SuppressMsg) in the ItemChanged event, when they've already
displayed an error message.
In ItemChanged event:
IF ... error situation ... THEN
  ... display message ...
  li_Return = 1 // reject value
END IF
// Bottom of ItemChanged script ...
// set flag so ItemError know to suppress its default message
IF li_Return = 1 THEN
  ib_SuppressMsg = True
END IFIn ItemError, check this flag and, if set, return 1 so the default ItemError message is suppressed:
IF ib_SuppressMsg THEN
  li_Return = 1
  ib_SuppressMsg = False // reset flag for next time
ELSE
  ... error not caused by ItemChanged
END IF