Skip to content

JS Function: <table>_<field>_postvalid

Description:
Execute post validation (OnBlur or WHEN IT LOSES FOCUS) on a field of a particular table. Table can be a Form table or a Grid table.


Usage

To be defined in project_core.js

function trn_yarnschlg_rate_postvalid(hotrow,hotcol,colname,oldval,newval){
   let rate = parseFloat(eval(newval));  //force convert the newval to float!
   let qty = grid1.getDataAtCell( hotrow, gridColNum('qty') );  //fetch value from a cell, here Qty. gridColNum('qty') function returns the actual column number of column named 'Qty'

   let amt = (rate * qty).toFixed(2);  //force set to 2 decimals only. Amount calculated manually here.

   grid1.setDataAtCell( hotrow, gridColNum('amount'), amt, 'AUTOSET' );  //here 'AUTOSET' does not execute the post validations. DO NOT PASS, if you wish to execute post validations / calculations.
}

Parameters

Name Type Description
hotrow number current grid row number
hotcol number current grid column number
colname string current grid column field name
oldval any Existing value prior to edit
newval any Current value after edit

Return

  • nothing