Forms

Blocs enables you to easily integrate a contact form into your website using the form Bric, which can be found in the Bric Bar.

Form Set Up

To begin setting up a form, first select the main form container. The easiest way to find the form container is by selecting one of the input fields nested within the form and then using the layer tree to navigate up the structure tree until you find the main form container layer which will be named Form.

In the sidebar inspector, you will now be presented with the form options. The two most important options that require attention are the Sendto and From input fields.

Sendto

In this field, enter the email address the form message will be sent to.

From

In this field, enter the email address that the form will appear to be sent from. This email address will be displayed as the sender’s email address, in email clients such as Mac Mail and Gmail.

Subject

In this field, enter the subject for all email messages received from the form.

Greeting

In this field, enter a short message that will be displayed at the top of all email messages received from the form.

Beginners Tip

The greeting message can be used to quickly identify specific form messages that are received from a website that has multiple contact forms.

Post Type

By default, forms added to a website in Blocs use the standard Mail() PHP post method. If your server does not support the PHP Mail() method, then you can use an SMTP mail server instead.

SMTP Mail Server

When using an SMTP mail server for a contact form, your Blocs website will communicate with your server using the Simple Mail Transfer Protocol to process its contents.

Add a SMTP Mail Server

Adding an SMTP mail server in Blocs is very similar to setting up a desktop email client. You will require the host, user name, password and port for your SMTP mail server (your hosting provider will be able to supply these).

To add an SMTP mail server to Blocs, first click the Add Mail Server option from the Post Type drop-down menu. This will open the Mail Server Manager window.

Next, click the + button located at the top right of the Mail Server Manager window and enter your SMTP mail server credentials into the popover that appears.

Once you have entered your mail server credentials, click the save button in the bottom right corner of the popover.

You will now find your mail server available in the Post Type drop-down menu, which is located in the sidebar inspector. Selecting it will enable the form to process its contents using your SMTP mail server instead of the default PHP mail() method.

Form Events

From the form options you can also set the success interaction and the fail message for the selected form. The success interaction is triggered if the form is successfully posted and the failure message is shown if there is a problem that prevents the form from posting.

Success Interaction

There are three success interaction options available to choose from. The first and most basic is to show a success message on the same page, the second is to go to a specific page on your Blocs website and the third is to go to a direct URL.


 

Beginners Tip

Form posting will not work when your site is run locally on your device. Forms will only be processed and sent when hosted on a web server that supports PHP and accessed within a web browser.

Troubleshooting

If you are not receiving the content from a form on your website, first check any spam folders on your receiving email address in case the emails have been moved there accidentally by the email client.

Next, check your Blocs project to confirm that all of the Bric input items within the form such as text fields, radios and checkboxes have unique ID’s set.

Finally, if you are using the PHP mail() method to post your website form, check that the server you are running your site from supports PHP and most importantly, it supports the PHP: mail method. If you inspect the page that contains the form, after it has been submitted, a console error will be logged if the mail() method is not available.

If mail() is not available on your server, then you will need to set up the form to use SMTP form posting or alternatively you could try using an email interaction link.

If the problem persists, you can contact support here.

Updated on 10th July 2024

Was this article helpful?

Related Articles