Class Frontend
- Namespace
- Dynamicweb.Forms
- Assembly
- Dynamicweb.Forms.dll
[AddInName("BasicForms")]
public class Frontend : ContentModule, IModule
- Inheritance
-
Frontend
- Implements
- Inherited Members
Constructors
Frontend(IContextAccessor, ConsentService, FormService, FormFieldService, SubmitService, SubmitDataService, UserContextProvider, UserService, UserGroupService, VirtualFilePathManager)
public Frontend(IContextAccessor contextAccessor, ConsentService consentService, FormService formService, FormFieldService formFieldService, SubmitService submitService, SubmitDataService submitDataService, UserContextProvider userContextProvider, UserService userService, UserGroupService userGroupService, VirtualFilePathManager virtualFilePathManager)
Parameters
contextAccessorIContextAccessorconsentServiceConsentServiceformServiceFormServiceformFieldServiceFormFieldServicesubmitServiceSubmitServicesubmitDataServiceSubmitDataServiceuserContextProviderUserContextProvideruserServiceUserServiceuserGroupServiceUserGroupServicevirtualFilePathManagerVirtualFilePathManager
Methods
CreateMailMessage(string, string, string?, string, string, string?, string?, string?)
Creates the mail message.
public MailMessage? CreateMailMessage(string subject, string body, string? fromName, string fromEmail, string to, string? cc, string? bcc, string? replyto)
Parameters
subjectstringThe subject.
bodystringThe body.
fromNamestringFrom na
fromEmailstringFrom email.
tostringTo.
ccstringThe cc.
bccstringThe BCC.
replytostring
Returns
- MailMessage
System.Net.Mail.MailMessage.
GetMaxSubmit()
Gets the maximum submit.
public int GetMaxSubmit()
Returns
- int
System.Int32.
GetModuleContent()
Override this method and return the HTML output for the module.
public override OutputResult GetModuleContent()
Returns
- OutputResult
Must return the markup that renders the module.
Examples
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Frontend;
using Dynamicweb.Modules;
namespace Dynamicweb.Examples;
[AddInName("ModuleSystemName")]
public class ContentModuleSample : ContentModule
{
public override OutputResult GetModuleContent()
{
//Get an instance of a template object
var template = new Dynamicweb.Rendering.Template("ModuleSystemName/Template.cshtml");
//Set a tag named "Text" with the value from the HelloText property
template.SetTag("Text", Properties.Values["HelloText"].ToString());
//Add the page id executing the page with the paragraph where this module is attached
template.SetTag("PageID", Pageview?.ID ?? 0);
//Return the parsed template to the event handler
return new ContentOutputResult
{
Content = template.Output()
};
}
}
Remarks
The markup returned is what is inserted into the template tag ParagraphModule in the paragraph template.
GetSubmitCount()
Gets the submit count.
public int GetSubmitCount()
Returns
- int
System.Int32.
HandleMaxSubmitCountAction()
public OutputResult HandleMaxSubmitCountAction()
Returns
MaxSubmitsReached(Form)
Checks the submit count.
public bool MaxSubmitsReached(Form form)
Parameters
formForm
Returns
RenderForm()
Renders the form.
public OutputResult RenderForm()
Returns
- OutputResult
System.String.
RenderMail(Submit)
Renders the form mail (website owner) to the Forms/Mail/*.cshtml|HTML template.
public string RenderMail(Submit submit)
Parameters
submitSubmitThe submitted data to render to the mail template.
Returns
- string
A string of email body in HTML.
RenderMailTemplate(Template, Submit)
Renders the receipt template.
public void RenderMailTemplate(Template template, Submit submit)
Parameters
RenderReceipt()
Renders the receipt.
public string RenderReceipt()
Returns
- string
System.String.
RenderReceiptMail(Submit)
Renders the receipt mail to the Forms/Mail/*.cshtml|HTML template.
public string RenderReceiptMail(Submit submit)
Parameters
submitSubmitThe submitted data to render to the mail template.
Returns
- string
A string of email body in HTML.
RenderReceiptTemplate(Template, Submit)
Renders the receipt template.
public void RenderReceiptTemplate(Template template, Submit submit)
Parameters
SaveForm()
Saves the form.
public OutputResult SaveForm()
Returns
- OutputResult
System.String.
SaveFormFiles(Field)
Saves the files submitted with a form.
public string SaveFormFiles(Field currentField)
Parameters
currentFieldFieldThe file upload field.
Returns
- string
System.String.
SendMail(Submit)
Sends the mail.
public void SendMail(Submit submit)
Parameters
submitSubmitThe s.
SendReceiptMail(Submit)
Sends the receipt mail.
public void SendReceiptMail(Submit submit)
Parameters
submitSubmitThe s.