Our monthly Virtual Happy Hour is happening this week, Fri Feb 23!

Try our conversational search powered by Generative AI!

Editing forms after submission


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.

Jun 25, 2018 13:02

Do you want to modify data before saving into Database (Submit => modify data => Save) or after saving into Database (Submit => Save data => Read => Modify) ?

Jun 26, 2018 8:15

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

Edited, Jun 26, 2018 8:26

Hei Quan ,

I need to modify the data after being submitted .

I tried using Submitted event but it didn't worked.

Jun 26, 2018 8:35

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);

Edited, Jun 26, 2018 9:19

Thanks for the reply.

I will explian you the scenario.

  1. First we use the event to submit the page and modilfy before submitting.
  2. Then we go to a payment gateway , this gateway is redirected from a controller.
  3. Payment page returns to same controller.
  4. Based on response from payment gateway , i need to update the Form submitted data from the controller.

I hope it helps to understand my problem.

Jun 26, 2018 10:08

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

Jun 26, 2018 10:46

Thanks Quan , it worked just fine. :)

Jun 26, 2018 11:30

You're welcome... laughing

Jun 27, 2018 6:40
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.