Data valuation before form submit (sum of 2 columns)

Gentlemen, I need advice.

This is the problem: the application in which invoices are entered, when entered, the budget item are selected.
The application should not allow you to enter an invoice for an amount greater than the budget in a given cost code.
Accordingly, the line of the “invoice amount” form has a maximum limit of no more than the budget balance. Everything was amazing.
BUT SUDDENLY
It has become necessary to save an additional invoice parameter “additional payment” (for example, to the advance invoice you need to add how much the full payment will be) and you no longer need to compare 1 column “invoice amount” with the budget, but the sum of the columns.

So I need to calculate cum of 2 columns and compare it with the budget, but the Form can’t do the calculation. It is possible to determine whether the amount corresponds to the budget only after making an entry.

Then I created fields for these calculations in the user table. There you can immediately calculate the amount and then enter it into the required table by performing an action on the form submit.

So the problem is that the form fields that are written to the User table cannot be specified as required! They show exceed but the user can submit form…

For now I decided this way - I left the comparison of the sum of the columns with the budget in the user’s table, but in the action after the submission I added a condition that if there was an excess, a message was displayed and the record was deleted… of course it doesn’t look elegant. It’s better if the entry simply cannot be made

any ideas?

I would consider making a custom form if you need to perform real time calculations. You still won’t have the ‘Required’ option, but you can build your own validation and prevent a row from being created if it doesn’t meet your criteria.

1 Like

So it is similar to how i calculate now in User table.

Similar, yes, except a custom form does not use a native form at all, and you create your own submit button instead of relying on the default button inside a native form.

1 Like