To work with a form or grid you need to have 2 fields for the encrypted DATA. One plain field and one encrypted field set by default to ‘’.
You set up the form using the normal field and hide the encrypted field.
When you insert the data, the normal field will contain the plain info.
In the onAfterInsert or onAfterUpdate event you do an update of your info
$SQL = "UPDATE table SET encryptfield = AES_ENCRYPT({field}, UNHEX(SHA2('My secret passphrase',512))), field = '' WHERE ID = {ID}";
sc_exec_sql($SQL);
Now your encrypted field contain the data and the plain field is empty.
In the onLoad event decrypt your field so the form or grid work correctly.
Sorry I don’t have more time to explain this. Use this as a base for your project, check my syntax I didn’t test it.