THIS IS PART OF CONTOUR SINCE v3.0 (so no need for this addon)
Another result of freedom fridays at the Umbraco HQ, an addon for Umbraco Contour the official form builder that will allow you to create/update forms from code.
It’s heavily inspired by uSiteBuilder (they did all the hard work).
With this addon you will be able to design your Contour forms from visual studio
public enum FormPages
{
Contact
}
public enum FormFieldsets
{
Details
}
[Form("Another Contact Form", MessageOnSubmit = "Thank you")]
public class AnotherContactForm : FormBase
{
[Field(FormPages.Contact, FormFieldsets.Details,
Mandatory = true)]
public string Name { get; set; }
[Field(FormPages.Contact, FormFieldsets.Details,
Mandatory = true)]
public string Email { get; set; }
[Field(FormPages.Contact, FormFieldsets.Details,
Mandatory = true,
Type = typeof(Umbraco.Forms.Core.Providers.FieldTypes.Textarea))]
public string Message { get; set; }
public override void Submit()
{
umbraco.library.SendMail(
Email,
"[email protected]",
"New Contact",
string.Format("New message from {0} : {1}",Name,Message),
false);
}
}
The download is an archive containing the assembly you'll need to get started for examples check out the sourcecode example project https://bitbucket.org/starfighter83/contour.addons.codefirst