Try our conversational search powered by Generative AI!

Create Episerver Form / add form elements programatically



I have a site that will contain several forms that may have a lot of fields, and there are several forms that have the same fields. Is it possible to create a form or add new form elements to an existing for programatically? It would help to be able to write code to generate all the forms rather than manually create each one, which would be tedious. It would also help so that I could run the same process to create the same forms on different databases/environments.



Apr 13, 2017 21:21


A few more thoughts on this. I realize that I can create a base form that includes the common fields, then copy and paste to create several forms. However, this doesn't help deploy forms between environments. In the Episerver Admin, I can select the forms in the Admin -> Tools -> Export Data, export to a file then in theory import the forms in the target environment. Has any one tried exporting/importing forms?



Apr 13, 2017 21:59

Forms use Block concept, and inherits everything from Block, both FormContainer and FormElements are Blocks.

Yes, you can export/import to replicate your content (Block, Form).


Apr 14, 2017 7:13

There is critical bug when export/import forms in version 4.4.4. You should wait Forms 4.5 to make sure it's safe.

Apr 14, 2017 9:14

Thanks for the info. I was able to write code to programatically create a form from scratch so I have what I need. It would help to be able to use export/import to move forms though. Thanks for the heads up on the issue with 4.4.4.

Apr 19, 2017 18:08

FYI Forms 4.5 was released on April 17, 2016 - see

Apr 19, 2017 21:41

Thank you Bob,

Importing content bug AFORM-1031 is fixed in 4.5

Apr 20, 2017 4:12
* 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.