Sitecore 营销人员模块的按钮图像

发布于 2024-11-19 23:27:32 字数 59 浏览 2 评论 0原文

我想使用 Sitecore 中的图像更改营销人员 Web 表单模块的提交按钮。

提前致谢

I want to change submit button of Web Forms for Marketers module with image in Sitecore.

Thank in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

雄赳赳气昂昂 2024-11-26 23:27:33

您可以通过更新以下文件的内容来更改按钮:

\sitecoremodules\Web\Web Forms for Marketers\Control\SitecoreSimpleFormAscx.ascx

替换

<wfm:FormSubmit ID="submit" runat="server" Class="scfSubmitButtonBorder"/>

为您自己的自定义控件(可以包含 Image / LinkBut​​ton /任何)

You can change the button by updating contents of the following file:

\sitecore modules\Web\Web Forms for Marketers\Control\SitecoreSimpleFormAscx.ascx

Replace

<wfm:FormSubmit ID="submit" runat="server" Class="scfSubmitButtonBorder"/>

with you own custom control (which can contain Image / LinkButton / whatever)

前事休说 2024-11-26 23:27:33

听起来您正在尝试将提交按钮更改为 。我还没有找到使用 WFFM 执行此操作的方法。您可以设置提交按钮的样式,也可以将表单导出到 ASCX 并自行更改图像。

您可以使用 的 CSS 样式做很多事情。

http://www.456bereastreet.com/lab/styling-表单控件重访/提交按钮/

It sounds like you are trying to change the submit button into an <input type="image" />. I have not found a way to do this with WFFM. You can style the submit button, or you can export the form to ASCX and make the change to an image yourself.

You can do quite a bit with CSS styling of <input type="submit" />.

http://www.456bereastreet.com/lab/styling-form-controls-revisited/submit-button/

养猫人 2024-11-26 23:27:33

您可以在 Default.css 中更改按钮样式。
使用background-image 添加图像。

下面的示例使用图像作为 WFFM 中“提交”按钮的背景:

.scfSubmitButtonBorder
{

    background-image: url(/images/bg_button.png);
    padding-left: 5px;
    float: right;
    margin-bottom: 10px;
}

.scfSubmitButtonBorder input
{

    border: none;
    padding: 0 5px 0 0;
    color: white;
    font: 14px/14px FrutigerRoman, Arial !important;
    width: 100px;
    height: 30px;
    background-image: url(/images/bg_button.png);
    background-position: right -30px;
    background-color: transparent;
    cursor: pointer;
}

You can change the button style in Default.css.
Use background-image to add the image.

Below example use an image as background for the Submit button in WFFM:

.scfSubmitButtonBorder
{

    background-image: url(/images/bg_button.png);
    padding-left: 5px;
    float: right;
    margin-bottom: 10px;
}

.scfSubmitButtonBorder input
{

    border: none;
    padding: 0 5px 0 0;
    color: white;
    font: 14px/14px FrutigerRoman, Arial !important;
    width: 100px;
    height: 30px;
    background-image: url(/images/bg_button.png);
    background-position: right -30px;
    background-color: transparent;
    cursor: pointer;
}
往事风中埋 2024-11-26 23:27:33

我想您正在谈论“营销人员网络表单”模块,不是吗?从您最初的问题来看,尚不清楚...

无论如何,在表单设计器中,您可以选择提交按钮,并将其属性放在左侧。在各种属性中,第一个是名为“按钮名称”的编辑框。将“提交”按钮所需的文本放在那里。

I suppose you're talking about Web Forms for Marketers module, aren't you? It is not clear from your initial question...

Anyway, in Form designer you can select the submit button and you'll its properties on the left side. Among various properties, the very first is the edit box called "Button Name" . Put the desired text for the Submit button there.

永不分离 2024-11-26 23:27:33

我是这样做的。

首先,创建自定义控件:

namespace Sitecore.Custom.Controls
{
    public class ImageSubmitButton : Sitecore.Form.Web.UI.Controls.SubmitButton
    {
        public string ImageUrl { get; set; }

        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(ImageUrl) == false)
            {
                writer.AddAttribute("type", "image");
                writer.AddAttribute("src", ResolveUrl(ImageUrl));
            }
            // This won't overwrite our explicit type="image"
            base.AddAttributesToRender(writer);
        }
    }
}

在sitecore中将表单导出为ASCX,使用开发人员中心创建一个新的子布局并将导出的ASCX代码复制到该文件中。首先,注册一个新的前缀

<%@ Register TagPrefix="ctrl" Namespace="Sitecore.Custom.Controls" Assembly="<AssemblyName>" %>

最后,更改

  <cc0:submitbutton runat="server" onclientclick="$scw.webform.lastSubmit = this.id;" text="Submit" validationgroup="..." cssclass="..." id="..." onclick="OnClick" >
  </cc0:submitbutton>

<ctrl:ImageSubmitButton ImageUrl="~/imgs/button.png" runat="server" OnClientClick="$scw.webform.lastSubmit = this.id;"
    Text="Submit" validationgroup="..." cssclass="..." id="..."
    OnClick="OnClick"></ctrl:ImageSubmitButton>

最后,用子布局替换项目中的表单。

Here's how I did it.

First, create a custom control:

namespace Sitecore.Custom.Controls
{
    public class ImageSubmitButton : Sitecore.Form.Web.UI.Controls.SubmitButton
    {
        public string ImageUrl { get; set; }

        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(ImageUrl) == false)
            {
                writer.AddAttribute("type", "image");
                writer.AddAttribute("src", ResolveUrl(ImageUrl));
            }
            // This won't overwrite our explicit type="image"
            base.AddAttributesToRender(writer);
        }
    }
}

Export the form as ASCX in sitecore, use the Developer Center to create a new Sublayout and copy the exported ASCX code into this file. First, register a new prefix

<%@ Register TagPrefix="ctrl" Namespace="Sitecore.Custom.Controls" Assembly="<AssemblyName>" %>

Finally, change

  <cc0:submitbutton runat="server" onclientclick="$scw.webform.lastSubmit = this.id;" text="Submit" validationgroup="..." cssclass="..." id="..." onclick="OnClick" >
  </cc0:submitbutton>

to

<ctrl:ImageSubmitButton ImageUrl="~/imgs/button.png" runat="server" OnClientClick="$scw.webform.lastSubmit = this.id;"
    Text="Submit" validationgroup="..." cssclass="..." id="..."
    OnClick="OnClick"></ctrl:ImageSubmitButton>

Finally, replace the form in your item with the sublayout.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文