Developer forum

Forum » Development » Serialize form object

Serialize form object

Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

I want to create a generic proxy-page to handle input from the "Forms for editors" module, as I want to handle the db-submissions myself.

Before submitting the form, I change the action for the form to point to my proxy-page instead. The proxy-page consists of a cshtml-file located outside DW.

I need to iterate through the form object after submission, in order to find and save the required form fields.

My thought was to serialize the form object and save it to a hidden form field. On the proxy-page I would then de-serialize it and iterate through the form fields, but how can I serialize the form object, before the form is submitted?

Edit: Should I look at the NotificationSubscriber instead?


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Kurt

I am not sure you can serialize the form object - as it is not marked as serializable.

Or are you talking about serialize to JSON?

In your Razor template, you could also just instantiate a new form object - Form.GetFormByID(formID) and run from that...?

BR Nicolai

Votes for this answer: 1
 
Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi Nicolai,

Sorry, for not being specific :) My thought was to serialize to JSON, but maybe the instatiation of a new form object can solve it instead.

Kind regards
Kurt

 
Nicolai Pedersen
Reply

Json serializing does not seem like a good idea. I would go for the new instance.

 
Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi Nicolai,

The GetFormByID is a method in the DW9 api, but the solution is DW 8.6.1.11. Are there any equivalents in DW8 api or do I need to make the SQL Query by hand?

Kind regards
Kurt

 
Nicolai Pedersen
Reply

Hi Kurt

In Dynamicweb 8, Dynamicweb.Modules.dll you have Dynamicweb.Modules.Forms.Form.GetFormById

BR Nicolai

 

You must be logged in to post in the forum