Setting a custom field when creating a form

Posted by Community Admin on 04-Aug-2018 13:48

Setting a custom field when creating a form

All Replies

Posted by Community Admin on 12-Jun-2017 00:00

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.

This thread is closed