Editing forms after submission

Vote:
 

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.

#194551
Jun 25, 2018 13:02
Vote:
 

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

#194584
Jun 26, 2018 8:15
Vote:
 

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




                        
#194586
Edited, Jun 26, 2018 8:26
Vote:
 

Hei Quan ,

I need to modify the data after being submitted .

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

#194587
Jun 26, 2018 8:35
Vote:
 

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



#194589
Edited, Jun 26, 2018 9:19
Vote:
 

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.

#194590
Jun 26, 2018 10:08
Vote:
 

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

#194595
Jun 26, 2018 10:46
Vote:
 

Thanks Quan , it worked just fine. :)

#194602
Jun 26, 2018 11:30
Vote:
 

You're welcome... laughing

#194635
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.