2015-07-13 50 views
0

我正在使用Sitecore 8更新2和WFFM模块。 我创建了一个使用WFFM的注册页面,除了下拉列表中的值(邮政编码,城市,性别......)以外,一切正常。WFFM - Sitecore:链接下拉到用户配置文件

我将所有表单字段链接到配置文件字段,但这些值永远不会我尝试将表单下拉菜单链接到配置文件上的下拉字段,链接到配置文件上的简单文本字段,但它从不填充任何值。

有谁知道这是为什么,我能做些什么来链接这些字段?

回答

2

这是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); 
    } 
} 
} 
+0

这会有所帮助,但是文本值将被存储而不是值的值。 – Timon