1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Default Values

Default Values

8 posts, 0 answered
  1. Femy
    Femy avatar
    37 posts
    Registered:
    02 Jan 2008
    10 Oct 2008
    Link to this post
    Hi
    Is there a way to have default values for some fields in the News Module. The default value should be editable by the client so it cannot be in the App_LocalResources files, has to be somewhere in the CMS. Any ideas?
    TIA
    FR
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    13 Oct 2008
    Link to this post
    Hi Femy,

    You could set a default values through your web.config file. You should alter the default value in accordance to your needs. Using this way you will be able to change the filed value by CMS admin section if necessary.

    <metaFields> 
    <add key="News.Summary" valueType="LongText" visible="True" searchable="True" sortable="True" defaultValue=""/> 
    <add key="News.Author" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue=""/> 
    <add key="News.Source" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue=""/> 
    </metafields> 

    I hope this helps

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Femy
    Femy avatar
    37 posts
    Registered:
    02 Jan 2008
    13 Oct 2008
    Link to this post
    My question is if I set it via the web.config, how can the client (who cannot go to Visual Studio and edit the web.config but ONLY access the Sitefinity admin interface) edit the default value by the CMS admin section? pls clarify this.
    TIA
    FR
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    14 Oct 2008
    Link to this post
    Hi Femy,

    All metaFields can be changed whenever you want through the Sitefinity Admin area. For example, if you set defaultValue="John" for News.Author, every time when you create a new news, John will be set as an author. If you want to change the author name, just replace it by typing the new name in the textbox. Give a try to this approach and you will see how it works.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. S. Webb
    S. Webb avatar
    36 posts
    Registered:
    28 Dec 2006
    06 Feb 2009
    Link to this post
    Hi,

    I've added a few custom metafields to the library module and tried setting the defaultValue but it doesn't seem to work, this is what I have in my config file

    <metafields> 
    ...  
            <add key="Libraries.Original_Issue_Date" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue=""/>  
            <add key="Libraries.Effective_Date" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue=""/>  
            <add key="Libraries.Revised_Date" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue=""/>  
            <add key="Libraries.Approved_By" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="test"/>  
    ...  
    </metafields> 

    I have this in my ControlPanelEdit file

     
                    <sfGCn:ContentMetaFields ID="editMetaFields" runat="server">  
                        <ItemTemplate> 
                            <h3> 
                                <asp:Literal ID="Literal11" runat="server" Text="<%$Resources:Details %>"></asp:Literal></h3>  
                            <fieldset class="set">  
                                <ol class="setIn">  
                                                                    <li> 
                                        <asp:Label ID="Label8" runat="server" AssociatedControlID="Original_Issue_Date" Text="Original Issue"></asp:Label> 
                                            <telerik:raddatepicker id="Original_Issue_Date" runat="server">  
                                            </telerik:raddatepicker> 
                                    </li> 
                                    <li> 
                                        <asp:Label ID="Label9" runat="server" AssociatedControlID="Effective_Date" Text="Effective Date"></asp:Label> 
                                            <telerik:raddatepicker id="Effective_Date" runat="server">  
                                            </telerik:raddatepicker> 
                                    </li> 
                                    <li> 
                                        <asp:Label ID="Label10" runat="server" AssociatedControlID="Revised_Date" Text="Revised Date"></asp:Label> 
                                            <telerik:raddatepicker id="Revised_Date" runat="server">  
                                            </telerik:raddatepicker> 
                                    </li> 
                                    <li> 
                                        <asp:Label ID="Label11" runat="server" AssociatedControlID="Approved_By" Text="Approved By"></asp:Label> 
                                        <asp:TextBox runat="server" ID="Approved_By"></asp:TextBox> 
                                    </li> 
                                </ol> 
                  
     
                            </fieldset> 
                             <div class="bottom">  
                                <div> 
                                    <!-- --> 
                                </div> 
                            </div> 
                              
                            <h3> 
                                <asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Tags %>"></asp:Literal></h3>  
                            <fieldset class="set">  
                                <ol class="setIn">  
                                    <li class="tags">  
                                        <sfTag:TagEditor ID="tagsControl" runat="server" /> 
                                    </li> 
                                </ol> 
                            </fieldset> 
                        </ItemTemplate> 
                    </sfGCn:ContentMetaFields> 


    Am I missing something?

    Thanks,
    Steve
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    06 Feb 2009
    Link to this post
    Hi S. Webb,

    Thank you for using our services.

    I regret to inform you that this is a bug related to metafields in Images and Documents. The default value is not applied.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. S. Webb
    S. Webb avatar
    36 posts
    Registered:
    28 Dec 2006
    06 Feb 2009
    Link to this post
    Hi,

    Thanks for getting back to me. I kinda thought it was a bug. Is there a work around for this?

    Best Regards,
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Feb 2009
    Link to this post
    Hello S. Webb,

    We will fix this for 3.6. The work around will require to override the half of the module, so it will be better for you to wait for a day or two.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
8 posts, 0 answered