Custom Dropdown in Sitecore form


Custom Dropdown in Sitecore form


     1Create a field template

        a. Create a template in /sitecore/templates/System/Forms/Fields.
             b.  Inherit this template from Templates/System/Forms/Fields/Dropdown List
             c. Check the shared checkbox for all your fields in this template.
             d. Create Standard values.

2. Create the View Model for custom field and razor view for displaying the form element

        aCreate a class, add the property, and override the InitItemProperties and UpdateItemFields                  methods.
            b. Build and deploy.
            c. Add a new folder ‘FormsDemo’ and place the view under it
            d. Deploy this folder to Website/Views/FormBuilder/FieldTemplates

Custom Dropdown  in sitecore form

3.       Customise the form element pane

a.       Switch to core database view and duplicate the DropDownList item at the path /sitecore/client/Applications/Forms/Components/Layouts/PropertyGridForm/PageSettings/Settings.

b.       Create List Item under the node /sitecore/client/Applications/FormsBuilder/Components/Layouts/PropertyGridForm/PageSettings/Settings/CustomDropDownList/ListItems based on FormTextBox Parameters template and name it as CustomFieldName

c.       Fill in the ‘Form Label’ field, to add field name which would appear on the editor while configuring the field properties.
d.       Set the binding configuration:

Comments

Popular posts from this blog

Search Page in Sitecore SXA

How to use snippets in SXA project