Ok just checking. As I looked at your syntax, it looks to be incorrect. Your formObject
object is a BizFormInfo object (new biz form) and not an actual form item. See code below:
protected void btnSubmit_Click(object sender, EventArgs e)
{
BizFormInfo formObject = BizFormInfoProvider.GetBizFormInfo("HomePageContactForm", SiteContext.CurrentSiteID);
// Gets the class name of the 'ContactUs' form
DataClassInfo formClass = DataClassInfoProvider.GetDataClassInfo(formObject.FormClassID);
if (formClass != null)
{
ObjectQuery<BizFormItem> data = BizFormItemProvider.GetItems(formClass.ClassName)
.WhereEquals("Email", Email.Text)
.Columns("Email");
if (DataHelper.DataSourceIsEmpty(data))
{
BizFormItem formRecord = BizFormItem.New(formClass.ClassName);
formRecord.SetValue("Email", Email.Text);
formRecord.SetValue("FormInserted", DateTime.Now);
formRecord.SetValue("FormUpdated", DateTime.Now);
formRecord.Insert();
Response.Redirect("/ThankYou");
}
else
{
Response.Redirect("/EmailExists", true);
}
}
}
You need to create a new instance of the BizFormItem BizFormItem.New(form class name)