【问题标题】:WFFM - Sitecore : linking dropdown to user profileWFFM - Sitecore:将下拉列表链接到用户个人资料
【发布时间】:2015-07-13 20:35:47
【问题描述】:

我正在使用 Sitecore 8 Update 2 和 WFFM 模块。 我使用 WFFM 创建了一个注册页面,除了下拉列表中的值(邮政编码、城市、性别……)外,一切正常

我将所有表单字段链接到配置文件字段,但从未填写这些值。我尝试将表单下拉列表链接到配置文件上的下拉字段,链接到配置文件上的简单文本字段,但它从未填写任何价值。

有谁知道这是为什么以及我可以做些什么来链接这些字段?

【问题讨论】:

    标签: c# sitecore web-forms-for-marketers


    【解决方案1】:

    这是 WFFM 中的一个错误。要修复它,请将以下代码添加到您的解决方案中,然后转到项目 /sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/List Types/Drop List 并将字段 MVC Type 设置为 {your namespace}.DropListField,[your dll name}

    namespace {your namespace}
    {
    using System.Collections.Generic;
    using System.Linq;
    
    using Sitecore.Data.Items;
    using Sitecore.Form.Core.Controls.Data;
    
    /// <summary>
    /// The drop list field.
    /// </summary>
    public class DropListField : Sitecore.Forms.Mvc.Models.Fields.DropListField
    {
        /// <summary>
        /// Initialises a new instance of the <see cref="DropListField"/> class.
        /// </summary>
        /// <param name="item">
        /// The item.
        /// </param>
        public DropListField(Item item)
            : base(item)
        {
        }
    
        /// <summary>
        /// The get result.
        /// </summary>
        /// <returns>
        /// The <see cref="ControlResult"/>.
        /// </returns>
        public override ControlResult GetResult()
        {
            var value = this.Value as List<string>;
            var selectListItem = this.Items.SingleOrDefault(x => x.Value == value.First());
            var str = selectListItem != null ? selectListItem.Text : string.Empty;
            return new ControlResult(this.ID.ToString(), this.Title, selectListItem != null ? selectListItem.Value : string.Empty, str);
        }
    }
    }
    

    【讨论】:

    • 这有帮助,但存储的是文本值而不是值值。
    【解决方案2】:

    听起来可能是这个错误:

    http://www.cmsbestpractices.com/bug-sitecore-8-with-web-forms-for-marketers-drop-list-entries-not-being-properly-recorded-in-xdb/

    使用 Robomongo 检查值是否正确存储在 MongoDB 中。

    【讨论】:

    • 我试过这个,没有帮助。编辑:这些值将存储在 MongoDB 中的什么位置?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-09
    • 2012-01-20
    • 2012-09-06
    • 2018-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多