Try our conversational search powered by Generative AI!

Create Episerver Form / add form elements programatically

Vote:
 

Hi,

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.

Thanks!

Rex

#177526
Apr 13, 2017 21:21
Vote:
 

Hi, 

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?

Thanks,

Rex

#177531
Apr 13, 2017 21:59
Vote:
 

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

T.

#177624
Apr 14, 2017 7:13
Vote:
 

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.

#177625
Apr 14, 2017 9:14
Vote:
 

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.

#177799
Apr 19, 2017 18:08
Vote:
 

FYI Forms 4.5 was released on April 17, 2016 - see http://world.episerver.com/documentation/Release-Notes/?versionFilter=4.5.0&packageFilter=EPiServer.Forms&typeFilter=All.

#177811
Apr 19, 2017 21:41
Vote:
 

Thank you Bob,

Importing content bug AFORM-1031 is fixed in 4.5

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