Change the section of a Custom Field

Posted by Community Admin on 03-Aug-2018 16:34

Change the section of a Custom Field

All Replies

Posted by Community Admin on 29-Apr-2011 00:00
Hi all,

I've created a bunch of custom fields (back-end - event content) but I'm not able to group them in different sections. So all the custom fields stay at the bottom of the page which is ugly.

Do you know how to set the section for a custom field? Or even order my custom fields.

Thanks a lot.
Posted by Community Admin on 03-May-2011 00:00
Hi Jonathan,

To set sections as shown in the screenshot (EventsSections.png) and swap/change position up and down between the custom sections you have to go YourProject/App_Data/Sitefinity/Configuration and look trough
those configuration files for events that are created for you when you create event:

EventsConfig.contentViewControls.EventsBackend.views.EventsBackendEdit
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendInsert
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendPreview
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendVersionPreview

in those configuration files you will see the custom fields you have created grouped in the CustomFieldsSection.

You can create your own custom section from there like:
<sections>
        <sections displayMode="Write" wrapperTag="Div" name="CustomFieldsSection1">
            <fields>
                <field rows="1" dataFieldName="Test11" wrapperTag="Li" title="Test11" example="ins11" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField" type:fieldType="System.RuntimeType, mscorlib" cssClass="" hidden="False" fieldName="Test11" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
                    <expandableDefinition expandText="" expanded="True" />
                    <validator expectedFormat="None" maxLength="0" minLength="0" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format." requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" resourceClassId="" />
                </field>
            </fields>
            <expandableDefinition expandText="" expanded="True" />
        </sections>
    </sections>

or going trough Settings for Events --> Controls --> EventsBackend --> Views -->EventsBackendEdit --> Sections and Create a new Section. You can then reorder the fields in your sections or move sections trough your Events configuration files. Please note that you need to make changes in all of the above mentioned configuration files.
If you need any further information, please do not hesitate to write back

Greetings,
Stanislav Velikov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 23-May-2011 00:00
Hi,
I would like to add another selection to the custom fields selections.
For example, a link field ('Telerik.Sitefinity.Web.UI.Fields.LinkField',)


How do I do it from the backend?

I thought when I am in the backend edit view,I can add a new custom field and in the field type, type in 'Telerik.Sitefinity.Web.UI.Fields.LinkField', but I get an error ." Cannot create an instance of Telerik.sitefinity.web.ui.fields.config.fielddefinition.element etc because it is an abstract class
Posted by Community Admin on 25-May-2011 00:00
Hello nana,

I suppose you mean " to add section to custom field". As mentioned when you create custom fields for Events ( or any other module that supports custom fields) those controls get added to Custom field section and you can add a new section Settings for Events --> Controls --> EventsBackend --> Views -->EventsBackendEdit --> Sections and Create a new Section. When you create the new section you can create the new custom field of the desired type Telerik.Sitefinity.Web.UI.Fields.LinkField under that section. You don't need to type "Telerik.Sitefinity.Web.UI.Fields.LinkField" because under the custom field section or your newly created you get a button at top that displays in a dropdown all available fields including Telerik.Sitefinity.Web.UI.Fields.LinkField.


Regards,
Stanislav Velikov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 25-May-2011 00:00
The dropdown list I have does not contain a linkfield type.
Posted by Community Admin on 27-May-2011 00:00
Hello nana,


You can add it as described in my previous posts trough the configuration files.

<field rows="1" HideIfValue="" id="" dataFieldName="CustomerRequest" displayMode="Write" wrapperTag="Li" title="http://somesite.com" description="" example="" fieldType="Telerik.Sitefinity.Web.UI.Fields.LinkField" type:fieldType="System.RuntimeType, mscorlib" fieldVirtualPath="" resourceClassId="" cssClass="" fieldName="namefield" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
          <expandableDefinition expandText="" expanded="True" />
          <validator expectedFormat="None" maxLength="-1" minLength="-1" regularExpression="" regularExpressionSeparator="" required="False" validateIfInvisible="True" />
        </field>


Regards,
Stanislav Velikov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 27-May-2011 00:00
Thanks.
Posted by Community Admin on 19-Aug-2011 00:00

Exist a User's guide with step by step, because i do everything and i nothing happen.

Is the same for Module? i am using sitefinity 4.1.

Posted by Community Admin on 22-Aug-2011 00:00
Hi Rafael,

Do you make the changes to all views?
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendEdit
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendInsert
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendPreview
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendVersionPreview
as mentioned in my first post. The changes are made in /App_Data/Sitefinity/Configuration.

Greetings,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 23-Aug-2011 00:00
Thanks it's working for me!!!

Greetings
Posted by Community Admin on 25-Aug-2011 00:00
Guys,

I'm trying to add a field to an existing section - Zip Code to the Location section of the Events Module. I can add the fields using the approach defined here but it does not persist.

Any idea on why? and what I can do to make this work.

Thanks
Posted by Community Admin on 31-Aug-2011 00:00
Hello Kalisha,

The approach mentioned here is maent for adding custom fields only in the custom field section because all configurations to this section are saved in the configuration files.
To add a custom field to existing section go to settings for the module where you want to add the field.(I will use events as example).
Events->Controls->EventsBackend->Views->(Select a view you require)->Sections->Select section->
Fields and create new field.

Kind regards,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 05-Sep-2011 00:00
We tried this, the field shows up but it's not persisted. We enter values for textfield type:
Datafield:ZipCode.PersistedValue
Display: Write
FieldName: ZipCode
css: sfShortField250

The text box appears in the Locations section and I can enter a value but the value isn't persisted since on edit of the content shows the value wasn't stored. Are we entering something wrong?
Posted by Community Admin on 07-Sep-2011 00:00
I am also moving my custom Zip Code field to the Locations section.

There is an easy way to do it using the config file:
EventsConfig.contentViewControls.EventsBackend.views.EventsBackendEdit.config

1. Create a new <sections> entry before the CustomFieldsSection <sections> entry and give it the name "LocationSection".  Whatever you put in the section will be displayed in the locations section.  If you feel nervous about manually creating the section in the config file, you could do it through the Sitefinity Advanced Settings as described by Stanislav and then go in and replace whatever field you created.

2. Cut and paste your fields from the custom section into the Locations section.

Your file will look something like this:

<?xml version="1.0" encoding="utf-8"?>
<view xmlns:config="urn:telerik:sitefinity:configuration"
      xmlns:type="urn:telerik:sitefinity:configuration:type"
      config:version="4.2.1650.0"
      viewName="EventsBackendEdit">
    <sections>
        <sections name="LocationSection">
            <fields>
 
                ... this is where you can move the custom fields.
 
            </fields>
        </sections>
        <sections displayMode="Write"
                  wrapperTag="Div"
                  name="CustomFieldsSection">
            <fields>
 
                ... this is where the custom fields are created initially.
 
            </fields>
            <expandableDefinition expanded="True" />
        </sections>
    </sections>
</view>

This method works nice because you get all the field settings that Sitefinity sets up the custom fields with.

Note that you will need to restart the web application (can be done by editing the web.config file) for the changes to take effect.
Posted by Community Admin on 08-Sep-2011 00:00
Hello Kalisha,

Refer to this forum post where there is a discussion about how to persist the content of a custom field.
var metaManager = Telerik.Sitefinity.Data.Metadata.MetadataManager.GetManager();
var type = metaManager.CreateMetaType(typeof(ContentItem));
metaManager.SaveChanges();


Best wishes,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 29-Sep-2011 00:00
Antoine, thank's alot, that worked!
Posted by Community Admin on 30-Oct-2013 00:00
Hi,

I know this is an old post, but is there anyway to get the custom field to show up in the list of new "field" elements?

I have a common custom element, that I'd like to be able to add through the backend settings vs editing the config file directly.  Edits directly in the config file, don't persist when changes are made to the dynamic modules.

I'd like to test to see if they persist when added directly through the backend settings interface.
Posted by Community Admin on 04-Nov-2013 00:00
Hello,

The list of elements is pulled from the built in fields types in Telerik.Sitefinity.dll assembly and as such the list can`t be updated to include a field from another assembly of a field present in the current site.

The problem where module builder configuration changes are not saved after making an update to any of the module fields or add new field is a feature that dynamically created modules don`t support, here is the feature request for preserving configuration changes.

Regards,
Stanislav Velikov
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
This thread is closed