I need a solution and I have one that works, but I'd still love to hear from anyone with a cleaner solution.
I ended up modifying the ResolveFields method in Composite.Forms.ContactForm.Functions.cs.
I changed this:
var prValue = pr.GetValue(dataItem, null).ToString().Replace(Environment.NewLine, "
");
XElement xl = XElement.Parse(String.Format("<span>{0}</span>", prValue));
reference.FieldReferenceElement.ReplaceWith(xl);
To this:
var prValue = pr.GetValue(dataItem, null).ToString().Replace(Environment.NewLine, "
");
if (pr.Name == "Department")
{
using (DataConnection con = new DataConnection())
{
prValue = con.Get<DepartmentContact>().Where(dc => dc.Id == new Guid(prValue)).SingleOrDefault().Department;
}
}
XElement xl = XElement.Parse(String.Format("<span>{0}</span>", prValue));
reference.FieldReferenceElement.ReplaceWith(xl);
I'd still like to know if there's an XLST solution.