Do you want to modify data before saving into Database (Submit => modify data => Save) or after saving into Database (Submit => Save data => Read => Modify) ?
If you want to format/modify data before saving into Database you can hook into Forms' Submitting Event.
Take a look at Forms Event Listener Demo
Hei Quan ,
I need to modify the data after being submitted .
I tried using Submitted event but it didn't worked.
Hi Himshikhar,
You can use Submitted Event with method below to modify submission data
public void ModifySubmissionData(FormsSubmittedEventArgs args) { // get form container block var formContainerBlock = args.FormsContent as FormContainerBlock; var formLocale = formContainerBlock as ILocale; // get form identity var formIdentity = new FormIdentity { Guid = formContainerBlock.Form.FormGuid, Language = formLocale.Language.Name }; var _submissionStorageFactoryy = ServiceLocator.Current.GetInstance<SubmissionStorageFactory>(); // get submission storage base on form instance's configuration var submissionStorage = _submissionStorageFactoryy.GetStorage(formIdentity); submissionStorage.UpdateToStorage(args.FormSubmissionId, formIdentity, args.SubmissionData); }
Thanks for the reply.
I will explian you the scenario.
I hope it helps to understand my problem.
Hi Himshikhar,
I think that whatever the business is, in order to update submission data stored in the database, we need to know FormIdentity and which FormSubmissionId were are going to update.
As the code above shows that we use UpdateToStorage method to update submission data. You have to keep track both FormIdentity and FormSubmissionId when redirecting between pages/controllers
Hello All ,
How I can manipulate data of a form which is submitted.
I can read it , but not modify it.
Any kind of input is appreciated.