Subform Validation
Posted: Thu Nov 03, 2022 12:16 pm
I have a form called Pick with a subform called pick_items.
On the subform I have a lookup called unit_id, this selects records in table stock WHERE stock.aval_qty > 0 after browse I use php:
nuSetFormValue('unit_id' , nuLookUpRecord()->item_id);
nuSetFormValue('product_code' , nuLookUpRecord()->item_code);
nuSetFormValue('aval_qty', nuLookUpRecord()->aval_qty);
This Sets the values for Item_id, Item_code and qty.
I then enter a value for the subform field qty, this value needs to be = or less than the aval_qty, how on saving the record can th subform rows be validated and if this condition is not meet an error message appear? Or should this be done when the value for qty on each row changes?
I also need the validation to make sure that the unit_id is only selected once on the subform, if I use properties validation no duplicates the next time I create a new Pick and choose a unit_id that was on a prevoius pick it says Unit ID on row 1 has a duplicate (pick_items).
On the subform I have a lookup called unit_id, this selects records in table stock WHERE stock.aval_qty > 0 after browse I use php:
nuSetFormValue('unit_id' , nuLookUpRecord()->item_id);
nuSetFormValue('product_code' , nuLookUpRecord()->item_code);
nuSetFormValue('aval_qty', nuLookUpRecord()->aval_qty);
This Sets the values for Item_id, Item_code and qty.
I then enter a value for the subform field qty, this value needs to be = or less than the aval_qty, how on saving the record can th subform rows be validated and if this condition is not meet an error message appear? Or should this be done when the value for qty on each row changes?
I also need the validation to make sure that the unit_id is only selected once on the subform, if I use properties validation no duplicates the next time I create a new Pick and choose a unit_id that was on a prevoius pick it says Unit ID on row 1 has a duplicate (pick_items).