转:http://yedward.net/?id=70
Form的validate行为可以由一个总的form级别的validation属性来控制,可以通过set_form_property来设置成PROPERTY_TRUE 和 PROPERTY_FALSE。当程序的焦点离开当前validation_unit(验证单元)时候,就会触发该validation_unit的validate事件,Validation unit的级别又是通过form的validation unit属性来设置的,有以下属性值:Default, form, block, record, item。
也就是说当设置validation unit为block时,只有当焦点离开一个block,才会触发validate,根据valiation unit的不同,validate又可分为validate form, validate block, validate record, validate item。
Validate form:validate form中所有block。
Validate block:validate block中所有record。
Validate record:如果该record为valid,则停止,否则validate该record中所有item,然后触发WHEN-VALIDATE-RECORD Trigger。
Validate item:如果当前item为valid,则停止,否则执行该item标准check,包括LOV(如果validate_from_list属性为true),最后触发WHEN-VALIDATE-ITEM Trigger。
也可以通过validate方法,来强制validate数据(注意:此时若form的validation属性设置为false,则强制 validate方法也不能validate数据),该方法的有一个参数,可以设定validate的级别:Default_scope,form_scope,block_scope,record_scope,item_scope,如:validate(block_scope)。Validate trigger主要有2个,WHEN-VALIDATE-ITEM以及WHEN-VALIDATE-RECORD,2个trigger都有form级别以及block级别,另外WHEN-VALDATE-ITEM还有item级别。
validate(block_scope)----验证当前块
可选参数:DEFAULT_SCOPE :Perform normal validation for the default scope, determined by the runtime platform.
Note: If you change the scope via SET_FORM_PROPERTY(VALIDATION UNIT) and then call VALIDATE(DEFAULT_SCOPE), you will override the default scope as defined in the form module. In this case, Oracle Forms will not validate at the default scope but at the scope defined by SET_FORM_PROPERTY.
FORM_SCOPE: Perform normal validation for the current form.
BLOCK_SCOPE: Perform normal validation for the current block.
RECORD_SCOPE :Perform normal validation for the current record.
ITEM_SCOPE: Perform normal validation for the current item.