Encrypt form field on submission prior to saving

Gregg Duncan asked on February 17, 2021 17:38

I have a form that asks for a social security number. We don't want to save the SSN in plain text. I thought I could modify the Generated Code for the form. But I can't find it. It says it's located in "~/App_Code/CMSClasses" but that path doesn't exist on the server. I tried copying the Generated Code and adding to the App_Code Folder with my modifications to Encrypt the field. But my modified code was never hit by the form submission.

Is there any way to do this without making the form a custom widget?

Correct Answer

Dmitry Bastron answered on February 17, 2021 18:31

Dear Gregg,

Please refer to this documentation article for more details. You would need to develop a custom module (not a custom form widget) and within this module you can hook into event and implement the logic you require on before form submit.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Dmitry Bastron answered on February 17, 2021 18:12

Hi Gregg,

I think there is an easier way of doing this thing. Just hook into a global event for this form submission, BizFormItemEvents.Insert.Before. You can access the raw data submitted and amend however you need it before it gets saved into the database.

0 votesVote for this answer Mark as a Correct answer

Gregg Duncan answered on February 17, 2021 18:18

Thanks for the reply Dmitry,

How exactly can I hook into that event without making it a custom form widget?

0 votesVote for this answer Mark as a Correct answer

Gregg Duncan answered on February 17, 2021 20:51

Thanks Dmitry. That's exactly what I needed. The documentation you linked to was for Document Events. But it lead me to the documentation on Form Events and it worked perfectly.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.