Try Now
More in this section

Forums / General Discussions / News Comment - Email

News Comment - Email

4 posts, 0 answered
  1. Mansoor
    Mansoor avatar
    52 posts
    29 Jul 2013
    14 Jan 2014
    Link to this post
    I want make required field for email in News comment..how to do that ?

    find the attached screenshot 

  2. Elena Ganeva
    Elena Ganeva avatar
    36 posts
    20 Jul 2016
    14 Jan 2014
    Link to this post

    Hello Mansoor,

    You can change the default validation of the Comments form by replacing the template for CommentsDetailView from the Sitefinity backend with the attached file. Please find the attachment, place it inside your SitefinityWebApp project and build it. Then go to the backend of the CMS Administration -> Settings -> Advanced -> Controls -> ViewMap  and create a new one with the following values:

    HostType: Telerik.Sitefinity.Modules.GenericContent.Web.UI.Views.CommentsDetailsView, Telerik.Sitefinity

    LayoutTemplatePath: ~/CommentsRequiredEmail.ascx

    In this template I modified the default validation of the email field by setting the Required option to true:

                        DisplayMode ="Write"
                                RequiredViolationMessage="<%$Resources:ContentResources, EmailCannotBeEmpty %>" 
                                MessageCssClass="sfError" />

    If you need any additional assistance on this matter please do not hesitate to ask.  

    Elena Ganeva
    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
  3. Joe
    Joe avatar
    21 posts
    01 Dec 2010
    18 Aug 2015 in reply to Elena Ganeva
    Link to this post
    Does this still work after 6.2?  I have an 8.0 project that i'm trying to override the comments widget submit form behavior and it's ignoring my control. 
  4. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    26 Oct 2016
    19 Aug 2015
    Link to this post
    Hello Joe,

    As you have noted in the ticket you have submitted related to this, you have managed to map your custom template for the Comments Submit Form by using the following for the HostType: Telerik.Sitefinity.Modules.Comments.Web.UI.Frontend.CommentsSubmitForm

    I also provided the default template for the Comments Submit Form in the ticket for your convenience. I am pasting it here as well:

    <%@ Control Language="C#"  %>
    <%@ Register Assembly="Telerik.Sitefinity" TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" %>
    <%@ Register Assembly="Telerik.Sitefinity" TagPrefix="sfFields" Namespace="Telerik.Sitefinity.Web.UI.Fields" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Comments.Web.UI.Frontend" TagPrefix="comments" %>
    <sf:ResourceLinks id="resLinks" runat="server" UseEmbeddedThemes="true" Theme="Basic">
        <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_common_min.css" Static="true" />
        <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_metro_min.css" Static="true" />
        <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.Rating.rating.css" Static="true" />
        <sf:ResourceFile JavaScriptLibrary="JQuery" />
        <sf:ResourceFile JavaScriptLibrary="KendoWeb" />
            ControlPropertyName="ImageUrl" />
    <sf:ClientLabelManager id="clientLabelManager" runat="server">
            <sf:ClientLabel ClassId="CommentsResources" Key="LeaveComment" runat="server" />      
            <sf:ClientLabel ClassId="CommentsResources" Key="NameWatermark" runat="server" /> 
            <sf:ClientLabel ClassId="CommentsResources" Key="EmailWatermark" runat="server" />      
            <sf:ClientLabel ClassId="CommentsResources" Key="CaptchavalidationError" runat="server" />      
    <sf:SitefinityLabel runat="server" ID="restrictedToAuthenticated" WrapperTagName="p" style="display:none;" CssClass="sfNeutral" />
    <sfFields:FormManager id="formManager" runat="server" />
    <div id="submitCommentForm" runat="server" class="sfcommentsFormWithAvatarWrp">
        <sf:Message ID="messageControl" runat="server" ElementTag="div" CssClass="sfMessage" RemoveAfter="30000" FadeDuration="10" />
        <asp:Image ID="avatarImage" runat="server" CssClass="sfcommentAuthorAvatar" />
        <div class="sfcommentsFormWrp">
            <div class="sfcommentsTitleWrp">
                <sf:SitefinityLabel ID="leaveComment"  runat="server" WrapperTagName="h2" CssClass="sfcommentsTitle" Text="<%$Resources:CommentsResources, LeaveComment%>"/>
            <fieldset class="sfcommentsForm">
                <ol class="sfcommentsFieldsList">
                    <li class="sfcommentsField sfcommentEditor">
                        <textarea id="commentEditor" runat="server"></textarea>
                        <sf:SitefinityLabel runat="server" ID="validationMessage" WrapperTagName="p" style="display:none;" CssClass="sfError" Text="<%$Resources:CommentsResources, EmptyCommentErrorMessage %>"></sf:SitefinityLabel>
                    <li class="sfcommentsField sfcommentRating">
                        <div id="ratingSection" class="sfRating sfcommentsThreadRatingWrp" runat="server"></div>
                        <sf:SitefinityLabel runat="server" ID="validationMessageRating" WrapperTagName="p" style="display:none;" CssClass="sfError" Text="<%$Resources:CommentsResources, NoRatingErrorMessage %>"></sf:SitefinityLabel>
                    <sfFields:TextField ID="nameTextField" runat="server" DisplayMode="Write" CssClass="sfcommentsField" WrapperTag="Li" TabIndex="1">
                            RequiredViolationMessage="Name cannot be empty"
                            MessageCssClass="sfError" />
                    <sfFields:TextField ID="emailTextField" runat="server" DisplayMode="Write" CssClass="sfcommentsField" WrapperTag="Li" TabIndex="1">
                            ExpectedFormat = "EmailAddress"
                            MessageCssClass="sfError" />
                    <li class="sfcommentsField sfcommentCaptcha">
                        <comments:RestfulCaptcha runat="server" ID="restfulCaptcha" style="display:none;"/>
                        <sf:SitefinityLabel id="captchaError" runat="server" Text="<%$Resources:CommentsResources, CaptchavalidationError%>" WrapperTagName="p" CssClass="sfError" style="display:none;" />
                <div class="sfcommentsSubmitBtnWrp">
                    <span id="loadingView" runat="server" style="display:none;">
                        <sf:SfImage ID="createLoadingImage" runat="server" AlternateText='Loading' />
                    <asp:Button runat="server" ID="submitCommentButton" Text="Submit" OnClientClick="return false" CssClass="sfcommentsSubmitBtn"  />
    The default template is also available under Design -> Widget Templates in the Sitefinity backend. You can type in the search field Comments submit form and the template should be displayed.

    Sabrie Nedzhip
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
4 posts, 0 answered