如何在我的umbraco表单中获取表单字段的别名
我正在使用umbraco表单,我想将电子邮件发送到该字段上的输入 我想设置后台umbraco表单字段的别名,必须通过工作流将电子邮件发送到该字段 但是,每当我尝试使用{fieldAliasName}发送带有umbraco表单字段项的电子邮件时,它都不起作用。但是,当我传递电子邮件地址时,它不是别名,而是在发送电子邮件 我想验证别名,如何从我的umbraco表单中看到它如何在我的umbraco表单中获取表单字段的别名,umbraco,umbraco7,Umbraco,Umbraco7,我正在使用umbraco表单,我想将电子邮件发送到该字段上的输入 我想设置后台umbraco表单字段的别名,必须通过工作流将电子邮件发送到该字段 但是,每当我尝试使用{fieldAliasName}发送带有umbraco表单字段项的电子邮件时,它都不起作用。但是,当我传递电子邮件地址时,它不是别名,而是在发送电子邮件 我想验证别名,如何从我的umbraco表单中看到它 尝试在那里循环所有现有表单 Umbraco.Forms.Data.Storage.FormStorage fs = new U
尝试在那里循环所有现有表单
Umbraco.Forms.Data.Storage.FormStorage fs = new Umbraco.Forms.Data.Storage.FormStorage();
foreach (var f in fs.GetAllForms())
{
Response.Write("Name:"+f.Name + ", Id:" + f.Id + "<br/>");
foreach (var field in f.AllFields) {
Response.Write("Alias:"+field.Alias + "<br/>");
}
}
Umbraco.Forms.Data.Storage.FormStorage fs=new Umbraco.Forms.Data.Storage.FormStorage();
foreach(fs.GetAllForms()中的var f)
{
响应。写下(“名称:+f.Name+”,Id:+f.Id+”
);
foreach(f.AllFields中的var字段){
响应。写入(“别名:+field.Alias+”
);
}
}
您肯定会找到他们的别名。尝试在那里循环所有现有表单
Umbraco.Forms.Data.Storage.FormStorage fs = new Umbraco.Forms.Data.Storage.FormStorage();
foreach (var f in fs.GetAllForms())
{
Response.Write("Name:"+f.Name + ", Id:" + f.Id + "<br/>");
foreach (var field in f.AllFields) {
Response.Write("Alias:"+field.Alias + "<br/>");
}
}
Umbraco.Forms.Data.Storage.FormStorage fs=new Umbraco.Forms.Data.Storage.FormStorage();
foreach(fs.GetAllForms()中的var f)
{
响应。写下(“名称:+f.Name+”,Id:+f.Id+”
);
foreach(f.AllFields中的var字段){
响应。写入(“别名:+field.Alias+”
);
}
}
你肯定会记住他们的别名。有很多方法可以做到这一点。不过,为了实现您的愿望,我建议创建一个自定义工作流。请参阅此处的文档:
public class FormSelectSendEmail : SendEmail
{
public FormSelectSendEmail()
{
Name = "Send Email to address in Form";
Id = new Guid("9077B74A-1DC7-487A-AB9A-04E7048D1780");
Description = "Send the result of the form to an email address typed into a form field";
}
[Setting("EmailField",
description = "Specify the field that email will be typed into.",
view = "~/App_Plugins/UmbracoFormExtensions/SettingTypes/fieldpicker.html")]
public string EmailField
{
get; set;
}
public override List<Exception> ValidateSettings()
{
var exceptions = new List<Exception>(base.ValidateSettings());
if (string.IsNullOrWhiteSpace(this.EmailField))
{
exceptions.Add(new Exception("'Email Field' has not been specified"));
}
return exceptions;
}
public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
{
var rf = record.RecordFields[new Guid(EmailField)];
string email = rf.ValuesAsString(true);
if (!string.IsNullOrWhiteSpace(email))
{
// TODO: Send the Email
return WorkflowExecutionStatus.Completed;
}
return WorkflowExecutionStatus.Cancelled;
}
}
源场
选择一个源字段
有很多方法可以做到这一点。不过,为了实现您的愿望,我建议创建一个自定义工作流。请参阅此处的文档:
public class FormSelectSendEmail : SendEmail
{
public FormSelectSendEmail()
{
Name = "Send Email to address in Form";
Id = new Guid("9077B74A-1DC7-487A-AB9A-04E7048D1780");
Description = "Send the result of the form to an email address typed into a form field";
}
[Setting("EmailField",
description = "Specify the field that email will be typed into.",
view = "~/App_Plugins/UmbracoFormExtensions/SettingTypes/fieldpicker.html")]
public string EmailField
{
get; set;
}
public override List<Exception> ValidateSettings()
{
var exceptions = new List<Exception>(base.ValidateSettings());
if (string.IsNullOrWhiteSpace(this.EmailField))
{
exceptions.Add(new Exception("'Email Field' has not been specified"));
}
return exceptions;
}
public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
{
var rf = record.RecordFields[new Guid(EmailField)];
string email = rf.ValuesAsString(true);
if (!string.IsNullOrWhiteSpace(email))
{
// TODO: Send the Email
return WorkflowExecutionStatus.Completed;
}
return WorkflowExecutionStatus.Cancelled;
}
}
源场
选择一个源字段
我总是打开表单的表单json文件(位于\App\u Plugins\UmbracoForms\Forms
)。我同意这很奇怪,没有办法像使用umbraco中的其他属性那样覆盖它。如何从umbraco管理页面访问该文件夹?我总是打开表单的表单json文件(位于\App\u Plugins\UmbracoForms\Forms
)。我同意这很奇怪,没有办法像使用umbraco中的其他属性那样覆盖它。如何从umbraco管理页面访问该文件夹?