4.1 Newsletter Widget
Where or how can I make edits to the Newsletter Widget? I only want an 'email' field displayed in the widget. I tried looking under the 'widget templates' but find nothing.
Thanks
Hi Scott ,
You can map the template for the SubscribeForm from the LayoutTemplatePath property of the widget (please see the attached screenshot). Please find below the default template we're using and the corrections I've done to it which hide the desired fields.
<%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<
fieldset
id
=
"formFieldset"
runat
=
"server"
class
=
"sfnewsletterForm sfSubscribe"
>
<
sitefinity:SitefinityLabel
id
=
"widgetTitle"
runat
=
"server"
WrapperTagName
=
"h2"
HideIfNoText
=
"true"
CssClass
=
"sfnewsletterTitle"
/>
<
sitefinity:SitefinityLabel
id
=
"widgetDescription"
runat
=
"server"
WrapperTagName
=
"p"
HideIfNoText
=
"true"
CssClass
=
"sfnewsletterDescription"
/>
<
sitefinity:Message
ID
=
"messageControl"
runat
=
"server"
FadeDuration
=
"3000"
/>
<
ol
class
=
"sfnewsletterFieldsList"
>
<
li
class
=
"sfnewsletterField"
>
<
asp:Label
ID
=
"emailAddressLabel"
runat
=
"server"
Text='<%$Resources:NewslettersResources, EmailAddress %>' AssociatedControlID="emailAddress" CssClass="sfTxtLbl" />
<
asp:TextBox
ID
=
"emailAddress"
runat
=
"server"
CssClass
=
"sfTxt"
/>
<
asp:RequiredFieldValidator
ID
=
"emailValidator"
runat
=
"server"
ControlToValidate
=
"emailAddress"
ValidationGroup
=
"subscribeForm"
CssClass
=
"sfErrorWrp"
Display
=
"Dynamic"
>
<
strong
class
=
"sfError"
><
asp:Literal
runat
=
"server"
ID
=
"lEmailIsRequired"
Text='<%$Resources:NewslettersResources, EmailIsRequired %>' /></
strong
>
</
asp:RequiredFieldValidator
>
</
li
>
<
li
class
=
"sfnewsletterField"
style
=
"display:none"
>
<
asp:Label
ID
=
"firstNameLabel"
runat
=
"server"
Text='<%$Resources:NewslettersResources, FirstNamePublicForm %>' AssociatedControlID="firstName" CssClass="sfTxtLbl" />
<
asp:TextBox
ID
=
"firstName"
runat
=
"server"
CssClass
=
"sfTxt"
/>
</
li
>
<
li
class
=
"sfnewsletterField"
style
=
"display:none"
>
<
asp:Label
ID
=
"lastNameLabel"
runat
=
"server"
Text='<%$Resources:NewslettersResources, LastNamePublicForm %>' AssociatedControlID="lastName" CssClass="sfTxtLbl" />
<
asp:TextBox
ID
=
"lastName"
runat
=
"server"
CssClass
=
"sfTxt"
/>
</
li
>
</
ol
>
<
div
class
=
"sfnewsletterSubmitBtnWrp"
>
<
asp:Button
ID
=
"subscribeButton"
runat
=
"server"
Text='<%$Resources:NewslettersResources, SubscribeToList %>' ValidationGroup="subscribeForm" CssClass="sfnewsletterSubmitBtn" />
</
div
>
</
fieldset
>
<
asp:Panel
ID
=
"selectListInstructionPanel"
runat
=
"server"
>
<
asp:Literal
ID
=
"pleaseSelectList"
runat
=
"server"
Text='<%$Resources:NewslettersResources, ClickEditAndSelectList %>' />
</
asp:Panel
>
I'm also attaching a copy of the template for your reference, you can plug it into your project. I hope you find this information useful. If any additional questions arise, please let us know.
Kind regards,
Boyan Barnev
the Telerik team
Hi
Can anyone help me with regard 'how to plug this in to my project' - I've tried most ideas I've found in the documentation and on the forums, and still nothing working... I can't even find where the original SuscribeForm resides within the Toolboxes... There doesn't seem to be an 'Email Campaigns' section in the Toolbox list for Page Controls... Any help much appreciated.
Thanks
Cheers
Richard
Hello Richard,
The original subscribe form code can be found in the source of Sitefinity. You can also download our SDK where you can find an extended template of the subscribe form - in near future we will try to include all control templates in the SDK. However if you want to modify the original template, please refer to the code bellow:
<%@ Control Language="C#" %>
<%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<
asp:Panel
ID
=
"errorsPanel"
runat
=
"server"
CssClass
=
"sfErrorSummary"
Visible
=
"false"
/>
<
fieldset
id
=
"formFieldset"
runat
=
"server"
class
=
"sfnewsletterForm sfSubscribe"
>
<
sitefinity:SitefinityLabel
id
=
"widgetTitle"
runat
=
"server"
WrapperTagName
=
"h2"
HideIfNoText
=
"true"
CssClass
=
"sfnewsletterTitle"
/>
<
sitefinity:SitefinityLabel
id
=
"widgetDescription"
runat
=
"server"
WrapperTagName
=
"p"
HideIfNoText
=
"true"
CssClass
=
"sfnewsletterDescription"
/>
<
sitefinity:Message
ID
=
"messageControl"
runat
=
"server"
FadeDuration
=
"3000"
/>
<
ol
class
=
"sfnewsletterFieldsList"
>
<
li
class
=
"sfnewsletterField"
>
<
asp:Label
ID
=
"emailAddressLabel"
runat
=
"server"
Text='<%$Resources:NewslettersResources, EmailAddress %>' AssociatedControlID="emailAddress" CssClass="sfTxtLbl" />
<
asp:TextBox
ID
=
"emailAddress"
runat
=
"server"
CssClass
=
"sfTxt"
/>
<
asp:RequiredFieldValidator
ID
=
"emailValidator"
runat
=
"server"
ControlToValidate
=
"emailAddress"
ValidationGroup
=
"subscribeForm"
CssClass
=
"sfErrorWrp"
Display
=
"Dynamic"
>
<
strong
class
=
"sfError"
><
asp:Literal
runat
=
"server"
ID
=
"lEmailIsRequired"
Text='<%$Resources:NewslettersResources, EmailIsRequired %>' /></
strong
>
</
asp:RequiredFieldValidator
>
<
asp:RegularExpressionValidator
ID
=
"emailRegExp"
runat
=
"server"
ControlToValidate
=
"emailAddress"
ValidationGroup
=
"subscribeForm"
ValidationExpression
=
"[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]2,4"
Display
=
"Dynamic"
CssClass
=
"sfErrorWrp"
ErrorMessage="<%$ Resources:ErrorMessages, EmailAddressViolationMessage %>">
<
strong
class
=
"sfError"
><
asp:Literal
ID
=
"lEmailNotValid"
runat
=
"server"
Text="<%$ Resources:ErrorMessages, EmailAddressViolationMessage %>" /></
strong
>
</
asp:RegularExpressionValidator
>
</
li
>
<
li
class
=
"sfnewsletterField"
>
<
asp:Label
ID
=
"firstNameLabel"
runat
=
"server"
Text='<%$Resources:NewslettersResources, FirstNamePublicForm %>' AssociatedControlID="firstName" CssClass="sfTxtLbl" />
<
asp:TextBox
ID
=
"firstName"
runat
=
"server"
CssClass
=
"sfTxt"
/>
</
li
>
<
li
class
=
"sfnewsletterField"
>
<
asp:Label
ID
=
"lastNameLabel"
runat
=
"server"
Text='<%$Resources:NewslettersResources, LastNamePublicForm %>' AssociatedControlID="lastName" CssClass="sfTxtLbl" />
<
asp:TextBox
ID
=
"lastName"
runat
=
"server"
CssClass
=
"sfTxt"
/>
</
li
>
</
ol
>
<
div
class
=
"sfnewsletterSubmitBtnWrp"
>
<
asp:Button
ID
=
"subscribeButton"
runat
=
"server"
Text='<%$Resources:NewslettersResources, SubscribeToList %>' ValidationGroup="subscribeForm" CssClass="sfnewsletterSubmitBtn" />
</
div
>
</
fieldset
>
<
asp:Panel
ID
=
"selectListInstructionPanel"
runat
=
"server"
>
<
asp:Literal
ID
=
"pleaseSelectList"
runat
=
"server"
Text='<%$Resources:NewslettersResources, ClickEditAndSelectList %>' />
</
asp:Panel
>
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 >>