Kentico 11 Forms

david ndlovu asked on October 18, 2019 15:52

Hi there

Can some please explain to me how do I use forms to post its data to another method in a class as I want to save the posted data to another Database table instead of "Recorded Data".

I have went through the documentation but did not get lucky

Best regards David

Recent Answers


David te Kloese answered on October 18, 2019 16:12

I assume you're using Portal and you do want to use Forms for all other functionalities (builder, notifier, etc,)

So probably easiest to use an Event Handler docs.kentico.com/k12/.../handling-global-events

And use the BizFormItemEvents docs.kentico.com/.../reference-global-system-events

To do something custom with the data after every insert.

--

Alternative could be to create a custom Web Part that would handle the whole form by itself, but that might be a lot more work...

0 votesVote for this answer Mark as a Correct answer

Ryan Nguyen answered on October 24, 2019 18:22

You can use BizForm and add custom code by hook to OnBeforeSave event:

protected override void OnLoad(EventArgs e)
     {
         viewBiz.OnBeforeSave += viewBiz_OnBeforeSave;
         base.OnLoad(e);
     }

private void viewBiz_OnBeforeSave(object sender, EventArgs e)
     {
         viewBiz.StopProcessing = true; // Prevent save data
         var data = viewBiz.Data.GetValue("Photos");
        // do more ...
     }
0 votesVote for this answer Mark as a Correct answer

david ndlovu answered on October 25, 2019 09:02

Thank you Chu and David.

0 votesVote for this answer Mark as a Correct answer

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