More in this section

Forums / Developing with Sitefinity / Setting a custom field when creating a form

Setting a custom field when creating a form

1 posts, 0 answered
  1. Jesse
    Jesse avatar
    0 posts
    Registered:
    12 Jun 2017
    12 Jun
    Link to this post

    Hi,

    I'm trying to add an additional field when creating a form to specify different types of forms for a custom module that I'm working on. The functionality I'm looking for is similar to adding custom fields to a page and setting the value of those fields when creating a page, however, it seems like the UI option for adding custom fields is not available for forms. I've tried to replicate this functionality in code by adding a custom field to the FormDescription type and I'm trying to set that field with a checkbox that I've added on the FormsBackendInsert view. However, I cannot get the checkbox to set the field. Is there something I am missing? As a side-note, I have also tested a custom string field with a TextFieldElement which doesn't update the custom field either.

     

    Added a custom field with the following code:

    App.WorkWith()
                    .DynamicData()
                    .Type(typeof(FormDescription))
                    .Field()
                    .TryCreateNew(FormsBackendCustomDataFieldName, typeof(bool))
                    .SaveChanges(true);

     

    Added the ChoiceFieldElement under advanced settings > Forms > Controls > FormsBackend > FormsBackendInsert > Sections > MainSection > Fields.

1 posts, 0 answered