The form below will add a new subscribed contact to your database, and display a success message on the page.
The attribute ContactMode="subscribe" is set on the <forms:form>
UI control, which will register a new contact or subscribe an existing one to the database.
You can alternatively use ContactMode="register" if you wish to show an error when the "contact is already registered,
please login".
<h4>Sign Up</h4>
<p>Enter your details to receive e-mail updates from us.</p>
<forms:form id="blog_signup_sidebar" method="ajax" contactmode="subscribe">
<forms:row label="* First and Last Names:">
<forms:editbox id="contact_first_name" width="70" validations="mandatory" /> <forms:editbox id="contact_last_name" width="133" validations="mandatory" />
</forms:row>
<forms:row label="* Email Address:">
<forms:editbox id="contact_email" width="240" validations="mandatory,email" transformations="tolower" />
</forms:row>
<forms:row type="one_column">
<forms:submitbutton value="Sign Up" />
</forms:row>
<forms:successcontent>
<h4>Thank you!</h4>
<p>You have been successfully signed up.</p>
</forms:successcontent>
</forms:form>
Request Marketing Consent
Contacts added to your database via other forms (such as contact forms), will be aded with the e-mail marketing status
"Pending" to flag inferred consent.
Adding to the previous contact enquiry form article, you can explicitly ask
users whether they want to receive e-mail newsletters, and set their e-mail marketing status to "subscribed" (line 12-14):
<forms:form id="contact_us" recordsubmissions="true" method="ajax" contactmode="store" onsubmitemailsubject="New Website Enquiry" onsubmitemail="info@mywebsite.com">
<forms:row label="First and Last Names">
<forms:editbox id="contact_first_name" width="80" validations="mandatory" />
<forms:editbox id="contact_last_name" width="110" validations="mandatory" />
</forms:row>
<forms:row label="E-mail Address">
<forms:editbox id="contact_email" width="200" validations="mandatory,email" transformations="tolower" />
</forms:row>
<forms:row type="one_column" label="Message">
<forms:textarea id="message" width="99%" height="130" validations="mandatory" />
</forms:row>
<forms:row type="one_column" label="Receive Our Newsletter">
<forms:checkbox id="contact_email_marketing_status" value="pending" valuechecked="subscribed" valueunchecked="pending" label="Subscribe to receive our e-mail newsletter." />
</forms:row>
<forms:row type="one_column" align="center">
<forms:submitbutton value="Submit" />
</forms:row>
<forms:successcontent>
<h3>Thank you!</h3>
<p>We have received your enquiry and will be in touch shortly.</p>
</forms:successcontent>
</forms:form>