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

Forums / Bugs & Issues / Meta data not being saved

Meta data not being saved

5 posts, 0 answered
  1. Nigel
    Nigel avatar
    38 posts
    Registered:
    01 Dec 2004
    18 Apr 2008
    Link to this post
    I feel like I must be doing something daft, but I can't see it.

    I've set up a second Blogs provider. Works great. Now I've tried to add some custom Meta fields to the new provider. Here's the relevant bits of config and code:

    web.config
    <add key="Books.BookSummary" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" /> 


    SiteFinity/Admin/ControlTemplates/Books/ControlPanelEdit.ascx and Insert
    <asp:TextBox ID="BookSummary" TextMode="MultiLine" Rows="3" Width="500" runat="server"></asp:TextBox> 
    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="BookSummary" Display="Dynamic" EnableViewState="False" CssClass="validMessage"   SetFocusOnError="True"><strong><asp:Literal ID="Literal23" runat="server" Text="Please add a summary."></asp:Literal></strong></asp:RequiredFieldValidator> 
    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"  
        ControlToValidate="BookSummary" Display="Dynamic" EnableViewState="False" 
        CssClass="validMessage" SetFocusOnError="True" 
        ValidationExpression="^(.|\n){0,250}$"><strong>The summary is too long. It must be 250 characters or less.</strong></asp:RegularExpressionValidator> 

    I can see in the database sf_GCMetaData that the meta field is being created for posts, however, it's an empty string regardless of what I type in the control panel. Additionally, if I manually enter some value into the ShortText column for the corresponding post and BookSummary row, it doesn't get displayed when editing the post.

    Any help much appreciated.
  2. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    19 Apr 2008
    Link to this post
    I assume you also have an add element for Books under the cmsEngine\providers section in your web.config.

    Could we see the code you are using to save/load the BookSummary value in your Control Panel form to edit/add the book?
  3. Nigel
    Nigel avatar
    38 posts
    Registered:
    01 Dec 2004
    21 Apr 2008
    Link to this post
    The provider works fine. Per the documentation, only markup is required in the control panel insert and edit controls, i.e. a textbox control with a tag that matches the meta field name.
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    23 Apr 2008
    Link to this post
    Hello Nigel,

    The reason your metafields could not to be saved is that you have inserted their markup in the wrong place (container) in the templates. As described in the User Manual -> Customizing Modules -> Add Custom fields, you have to add your meta fields in this container :
    <sfGCn:ContentMetaFields ID="editMetaFields" runat="server">  
    ..
    </sfGCn:ContentMetaFields>

    We have noticed this in your files which you sent in the support thread. After making these changes, all data from the fields was saved successfully.

    Don't hesitate to contact us if you have other questions.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Nigel
    Nigel avatar
    38 posts
    Registered:
    01 Dec 2004
    23 Apr 2008
    Link to this post
    Hi Georgi

    Many thanks for the solution. I had been looking at Developers Manual > Add Custom Meta Fields where the container you mention is not referenced. Just to let you know for the next time you update the Developer Manual chm.

    Cheers
Register for webinar
5 posts, 0 answered