# How to add a form to a page

In Solodev, you can add a form to a web page to collect information for almost any kind of application. This includes contact forms, order forms, newsletter subscriptions, product registrations, and more. In this tutorial, you will learn the different ways to create a form using Solodev and how to add it to your web page.

# Prerequisites

  • You will need to add a website to your Solodev CMS.
  • After selecting a website, you will need to add a page for your form.
  • You will need to be familiar with using shortcodes.

# Form options

From the main dashboard, there are three ways to add a form to Solodev:

  • Form Studio: Solodev’s drag-and-drop Form Studio lets you build your own custom forms with granular control – without touching a line of code. Instantly add text, images, input fields, radio buttons, and more. Save your form and apply it to your page in minutes.

  • Upload Template: If you already have an existing template for your form, you can upload it directly as a .tpl file into Solodev and apply it to your page.

  • Upload HTML: If you prefer working in raw HTML, you can code your own form and upload to Solodev.

# Building a form with Form Studio

Form Studio is a built-in drag-and-drop WYSIWYG editor that allows you to directly compose your own custom form. The visual editor consists of a left toolbar for dragging layout, content, and form components onto the canvas in the center. See table below for details.

The right toolbar enables you to control the text, styling, and specific details of the components in your form. Under the Settings icon, you can adjust your form header, links, and other details.

form settings

Using the Pencil icon, you can customize attributes such as layout, position, border radius, size, typography, and background components by entering values or clicking/dragging arrows. The right toolbar also provides Body attributes that detail the components in each div.

form body

Step 1: From your main CMS dashboard, click Forms in the left-hand menu.

Step 2: On the main forms dashboard, click Add Form.

form upload

Step 3: First, provide a name to your form in the Name field. For this example, call it contact-form.

Step 4: Pick an install location in Solodev by clicking Browse. Select an object and click Choose.

form choose object

Step 5: Use the drag-and-drop Form Studio tools to build your form. As with previous lessons, you can use the SpaceJet theme sample as a guide for creating the fields as shown:

form choose object

# Layout

Left toolbar Description Right toolbar options
Container Provides a controllable container to
position and pad objects like text, images,
and input fields
• Fluid: allows container to stretch to full browser width
• Non-Fluid: constrains container based on specific width
• Link settings: add a URL, email, or phone link.
• Set form to open in a new tab
• Full control of appearance
Columns Allows you to organize your form content
into pre-defined columns
• Column settings: set the number of columns and padding
• Link settings: add a URL, email, or phone link
• Set form to open in a new tab
• Full control of appearance

# Content

Left toolbar Description Right toolbar options
Header Provides a text header to your form. • Header settings: set the H1 or other hierarchal status of your text
• Link settings: add a URL, email, or phone link
• Set form to open in a new tab
• Full control of appearance
Paragraph Insert a paragraph block of text in your form. • Full flexibility of appearance.
Image Add a custom image to your form. • Fluid: allows image to stretch to the full browser width
• Non-Fluid: constrains image based on specific dimensions
• Image properties: adjust shape, width, and height.
• ALT text: add data for accessibility
• Link settings: add a URL, email, or phone link
• Full control of appearance

# Forms

Left toolbar Description Right toolbar options
Input Add fields for input data such as name, email, phone number, etc. • Add custom label, name, ID, and placeholder
• Input types: text, number, password, email, search, URL, or phone
• Full control of appearance
File Enables a user to upload a file such as a document, PDF, etc. • ID and name
• Button properties: adjust text and color
Text Area Include a field for long-form text. • Specify label, name, ID, placeholder, and helper text.
Checkbox Create pre-defined options with corresponding checkboxes. • Adjust label, name, and ID.
• Button properties: adjust text and color
Select Add a picker with a dropdown menu of options. • Add custom menu list text
• Select settings for helper text, placeholder, label, name, and ID.
Radio Button Create pre-defined options with corresponding radio buttons. • Adjust label, name, and ID.
Form Button Add a custom button to submit your form. • Link settings: add a URL, email, or phone link
• Button properties: adjust text, size, style, and color.

Step 4: Click and hold the form element, then drag it to the desired location on the form canvas.

Step 5: Adjust the element's position and spacing if needed by dragging it to a new location or aligning it with other elements.

Step 6: Customize the element properties, such as label text, input type, and validation rules, using the properties panel on the right.

Step 7: Save your changes by clicking the Save button to store the template.

# How to upload a form template (.tpl)

If you have a pre-built form template available – perhaps from a previous website project – you also have the option to upload it directly to Solodev and add it to a page.

Step 1: From your main CMS dashboard, click Forms in the left-hand menu.

Step 2: On the main forms dashboard, click Add Form.

form upload

Step 3: In the header at the top of the Form Builder screen, provide a name to your form in the Name field.

Step 4: To the right of the Name field, locate where it says Template (Optional). Click the button that reads Upload TPL file.

form upload

Step 5: Pick an install location in Solodev by clicking Browse. Then, select a specific destination (labeled object) and click Choose to select the folder.

form browse

Step 6: Once complete, click Save.

# How to add a form using HTML

In Solodev, you also have the option of adding your own custom form code using HTML.

Step 1: From your main CMS dashboard, click Forms in the left-hand menu.

Step 2: On the main forms dashboard, click Add Form.

Step 3: In the Form Studio dashboard, locate and click the Code button in the lower right corner.

form browse

Step 4: Add your HTML code to the code editor.

form browse

Step 5: Once complete, click Save.

# How to add a form to a page

Once you have created or uploaded your form to Solodev, you are now ready to add it to a page. While a form can be added to any page on your website, we are going to use the SpaceJet “Get Started” page, which provides a contact form for visitors. For this application, we are using a Solodev data table form.

Step 1: From your main dashboard, click on the www folder in the left-hand menu.

Step 2: Using the right-hand menu, click Add Folder. Name the folder contact.

add-form-contact-folder

Step 3: In the right-hand menu, click Add Page. Name the page index.stml, and title it Get Started. Once complete, click Submit.

add-page

Step 4: In the left-hand menu, under web files, click on the content folder. In the right-hand menu, click Add Folder. Name the folder contact.

Step 5: In the right-hand menu, click Add File. Name it contact.tpl and under File Type, select Code. Once complete, click Submit.

add-file-contact-tpl

Step 6: Click on the contact.tpl file. In the code editor, add the sample code below for the SpaceJet contact page. Once complete, click Publish.

add-form-page-code

<div class="container my-5">
  <div class="test-center">
    <h1><strong>Get Started</strong></h1>
    <p> Talk to one of our crew members to plan your trip </p>
  </div>
  
  [form id="70"]
</div>

Step 7: Go back to the main dashboard and click on Forms in the left menu. You will see your contact-form in the central table.

forms-dashboard-get-id

Step 8: In the data table, locate the form ID in the upper left corner. In this example, the form ID is “70.”

form id

Step 9: Go back to web files, and under the contact folder, click on the contact.tpl file to access the code. In line 7, replace the form ID with the actual ID from your for data table. As previously noted, “70” is a placeholder. Once complete, click Publish.

add-form-id

Step 10: In the www folder, click on index.stml under the contact folder. In the editor canvas, click on the appropriate div and select the contact.tpl file to apply it.

add-form-div

Once complete, click Publish.

After publishing, you will now see your form appear on your page.

form page

# How to add a submission message

Whether you are creating a lead form or a contact form, it is always a best practice to display that a visitor's information has been received. This is referred to as a submission or "thank you" message, and can be customized to meet your specific requirements.

For the purposes of this lesson, you can use the sample code below to create a submission message.

Step 1: Create an HTML file with the message you want to display after a form has been submitted, and save it to your local system. You can use the sample code below:

<h3 class="text-center mt-5">Thank you for contacting us. Someone will be in touch soon.</h3>

Step 2: Click modify and go to the Email Options accordion.

email modify

Step 3: Click Upload Return Page and select the file you previously created.

email options

Step 4: Click Submit.

Step 5: Access your forms module from the main dashboard or via your forms folder under web files. Check the data table to confirm that your submission has been received.

# How to add an email tickler

You can use this option to send form submissions to an email address you designate. For example, when a potential customer signs up for a free trial of your product, an email can be sent to your sales team to notify them of a possible lead.

Step 1: Follow the previous step 2 to navigate to the Email Options section.

Step 2: Under tickler information, add a valid email address on the Tickler Email Address field and click the Add button. You will see the email address added to the textarea below.

tickler

Step 3: You can add as many email addresses as you want. When you are done, click Submit.

tickler-list

# Next Steps