Trim and change to null before saving |
1/8/2025 3:04:02 PM |
PHPRunner General questions | |
A
asawyer13 authorDevClub member
I have users that like to accidentally add extra spaces to the end of test fields and sometimes even the beginning of text fields. I know I can specify the field name and do a trim in the before aded and before update events, but is there a safe way to loop thru all fields on the page and do it easily? Also I know I can go into each text field in the page and click on "Insert NULL values instead of empty strings" but sometimes I forget. Can I change all the fields to null if empty while I'm looping thru the fields above? Thanks |
|
A
|
asawyer13 authorDevClub member 1/10/2025 |
Would it be safe to run a query on Before Add or the Before Update that gets all the column names in the table and then do a trim($values[$column]) before saving? I realize many columns wouldn't be in the pages itself, but seems like that might be a safe thing to do, rather than have to manually add a lot of Trim statements? Alan |