- Published on
Sitefinity anonymous form submissions
- Authors
- Name
- Steve McNiven
- @stevemcniven
By default if a user is logged into Sitefinity a form submission will save their UserId to sf_form_entry, and thus the backend form responses show their username.
However it’s not uncommon to want to have a form for anonymous submission. Maybe you want a whistleblower form or something.
The problem though is there’s nothing in the UI to allow for this, and moreover there’s only 2 events in the Forms EventHub. Created (Already saved to the database) and Updated (…entry updated). Neither allow data to be manipulated before save.
So very simply this runs a parameterized sql query to update that userid to a Guid.Empty anonymous user right after the entry is created. Feel free to blow all of the whistles.