This topic is locked
[SOLVED]

Storing value in negative

8/11/2022 7:22:18 AM
PHPRunner General questions
S
Sayed author

On Add/Edit Page, I want a field value to be stored in database with negative.
If input is 50. It should be stored in database as -50
How to handle it?

Sergey Kornilov admin 8/11/2022

This sounds like a job for BeforeAdd & BeforeEdit events. It can be something simple like this:

$values["FieldName"] = $values["FieldName"] * -1;

S
Sayed author 8/12/2022

Thanks for easy solution.