Tip #25: How to add background images to forms

Tip #25: How to add background images to forms

Hi everyone,


The world is going through a difficult time right now, and we hope you're all staying safe.


We're here with another Creator tip—this time on how to add background images to your forms. Sometimes, to add some context or make your forms look a little better, you may want to add a background color or an image to your form. Let's go over the three easy steps it takes to get the job done.

Use case


In this example, we have a New Order form, and we'd like to add the company's logo to it, to help establish better brand recall and create an association with our customers.

Application flow


1Create the New Order form which will help customers place orders.
2. Create a page using HTML snippets to embed the form. 
3. Use CSS code to add the background image.

Here are some quick steps to add background images to your form from scratch:



Step 1: Create the New Order form, with all the required fields

Here are the fields on the order form:
  • Sales Owner (Lookup field)

  • Customer (Dropdown field)

  • Order Date (Date field)

  • Delivery Agency (Dropdown field)

  • Estimated Delivery date (Date field)

  • Product (Dropdown field)

  • Quantity (Number field)

  • Sub Total (Currency field)

  • Tax (Percentage field)

  • Net Total (Currency field)



Step 2: Create a page and add an HTML snippet to it

 

We need to embed the form into a page, so that we can add the required styling elements we need. All you need to do is 
drag and drop the HTML snippet onto the page, then add the following code to it:
  1. <div elName='zc-component' formLinkName='Order'
  2. params='zc_Header=false&amp;zc_SuccMsg=Data Added
  3. Successfully!&amp;zc_SubmitVal=Submit&amp;zc_ResetVal=Reset'>Loading Form...</div>
Here "Order" is the form link name of the form. You could also embed the form into the iframe using iframe HTML tags. 



Step 3: Paste the CSS code into the HTML snippet


We need to use CSS to specify aspects like size and typeface for the fonts, colors for the text and backgrounds, alignment of the images, add space between  a border to the elements, and more.
 
You can use the following CSS code to add the background image:

  1. <style>

  2. .zcform_FormLinkName .formContainer {
  3. background-image:url(<Image URL>);
  4. background-size:cover;
  5. <\style>


In this code:


FormLinkName: Form name as per in the form's URL.
Image URL: A public URL of the image you want to display in the form's background

Note
  • You can customize the size of the background image with the "background-size" CSS styling.

  • Use a single white-space character between the form link name and .formContainer—it's important to make this CSS styling work.

  • Please avoid using this property when there are subforms or any hidden fields in the form, as it increases the form's height based on added subform rows, which results in enlarging the background image automatically.

Given below is how this page will look:



Easy, right? You should give it a try! If you face any difficulties while adding an image to your forms, please comment below and we'll be happy to assist you.


    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now