News Comment - Email - General Discussions - General Discussions - Progress Community
 General Discussions

News Comment - Email

  • News Comment - Email
  • 01b44d1e-37c1-6deb-a958-ff0000446526_newscomment-email.png
    Hi,
    I want make required field for email in News comment..how to do that ?

    find the attached screenshot 

    regards
    mansoor
  • 983675e0-1f13-4715-8c40-6bdae3e20210_CommentsRequiredEmail.zip

    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:

    <sf:TextField
                        ID="email"
                        runat="server"
                        DisplayMode ="Write"
                        Title="Email">
                            <ValidatorDefinition
                                RequiredViolationMessage="<%$Resources:ContentResources, EmailCannotBeEmpty %>" 
                                ExpectedFormat="EmailAddress"
                                Required="true"
                                MessageCssClass="sfError" />
                    </sf:TextField>

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



    Regards,
    Elena Ganeva
    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
  • 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. 
  • 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" />
        <sf:EmbeddedResourcePropertySetter
            Name="Telerik.Sitefinity.Resources.Themes.Default.Images.Loadings.sfLoadingFormBtns.gif"
            Static="true"
            ControlID="createLoadingImage"
            ControlPropertyName="ImageUrl" />
    </sf:ResourceLinks>
      
    <sf:ClientLabelManager id="clientLabelManager" runat="server">
        <labels>
            <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" />      
        </labels>
    </sf:ClientLabelManager>
      
    <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%>"/>
            </div>
            <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>
                      
                    <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>
                    </li>
      
                    <sfFields:TextField ID="nameTextField" runat="server" DisplayMode="Write" CssClass="sfcommentsField" WrapperTag="Li" TabIndex="1">
                        <ValidatorDefinition
                            Required="true"
                            RequiredViolationMessage="Name cannot be empty"
                            MessageCssClass="sfError" />
                    </sfFields:TextField>
                    <sfFields:TextField ID="emailTextField" runat="server" DisplayMode="Write" CssClass="sfcommentsField" WrapperTag="Li" TabIndex="1">
                        <ValidatorDefinition
                            ExpectedFormat = "EmailAddress"
                            MessageCssClass="sfError" />
                    </sfFields:TextField>
                    <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;" />
                    </li>
                </ol>
                <div class="sfcommentsSubmitBtnWrp">
                    <span id="loadingView" runat="server" style="display:none;">
                        <sf:SfImage ID="createLoadingImage" runat="server" AlternateText='Loading' />
                    </span>
                    <asp:Button runat="server" ID="submitCommentButton" Text="Submit" OnClientClick="return false" CssClass="sfcommentsSubmitBtn"  />
                </div>
            </fieldset>
        </div>
    </div>
     
    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.

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