Tenant selection forms

To create a customized entry form with the choice of the division, you will proceed as in the case of the basic form:

Create an HTML document, add CSS styles, and use JavaScript to ensure that you send data from the form and assign the client to the queue. Then you upload the created form to any hosting that supports the HTTPS protocol and add a link to the form in the administration interface.

Again, we recommend creating an entry form using the codepen.io web application for simplicity and clarity. You can start by clicking on this link. The code editor we use is linked to the bootstrap framework as a small simplebar library, due to the difficulties with iframe scrolling on iOS.

How the form looks

Direct link to insert this form into the administration of the mluvii application: https://mluvii.github.io/customization/entry_form_departments.html

HTML

Compared to the basic form, this form consists of two slides - a classic form with data and selection of the department. Slides are created using the Swipper library.

The first two div tags (and css and javascript linked to them) serve to display your own scrollbars for better user experience on mobile devices.

CSS Styling

Most CSS is already secured with Bootstrap and Swipper.

JavaScript code

The information about the selected department is sent along with other data from the form in the feature called custom variable “department” on the submission of the form.

For full API form capabilities, see the general instructions on creating an feedback form.

Uploading the form to any hosting

If you used codepen.io to create the form, first click the Save button, then export to .zip format.

You have a form prepared, now you need to upload the form to the Internet so we can refer to it from the administration interface. In our case, we will use the GitHub site. You can find more information here.

If you use a tool other than codepen.io, the form code will look like this:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
  <link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.3.3/css/swiper.min.css" rel="stylesheet" />
  <link rel="stylesheet" href="https://unpkg.com/simplebar@3.1.0/dist/simplebar.css" />
  <style>
    .scroll-container {
      max-height: 107vh;
      height: 100%;
      width: 1px !important;
      min-width: 100% !important;
      max-width: 100% !important;
    }
    .scroll {
      max-width: 100% !important;
    }
    .swiper-container {
      height: 100%;
    }

    .swiper-slide {
      display: flex;
      padding: 1rem 1rem 2rem 1rem;
    }

    .card {
      width: 100%;
      overflow: auto;
      border-radius: 1rem;
      box-shadow: 0 0 1rem -0.5rem rgba(24, 28, 32, 0.5);
    }

    .form-control, .btn {
      border-radius: 0.5rem;
    }

    .curp {
      cursor: pointer;
    }
  </style>
</head>
<body>
  <div class="scroll-container">
    <div class="scroll" data-simplebar>
      <div class="swiper-container">
          <div class="swiper-wrapper">
            
            <!-- First slide start -->
            <div class="swiper-slide swiper-no-swiping">
              <div class="card">
                <div class="card-body">
                  <form id="main_form" class="w-100">
                    <div class="form-group">
                      <label for="name" class="mb-1">Jméno</label>
                      <input type="text" class="form-control" id="name" placeholder="Jméno">
                    </div>
                    <div class="form-group">
                      <label for="email" class="mb-1">E-mail</label>
                      <input type="email" class="form-control" id="email" placeholder="E-mail">
                    </div>
                    <div class="form-group">
                      <label for="phone" class="mb-1">Telefon</label>
                      <input type="text" class="form-control" id="phone" placeholder="Telefon">
                    </div>
                  </form>
                  <div class="text-center">
                    <button type="submit" form="main_form" class="btn btn-primary mt-3">
                      Pokračovat
                    </button>
                  </div>
                </div>
              </div>
            </div>
            <!-- First slide end -->
            
            <!-- Second slide start -->
            <div class="swiper-slide swiper-no-swiping">
              <div class="card">
                <div class="card-body">	
                  <h5 class="mb-0 text-center">
                    Vyberte prosím oddělení, se kterým se chcete spojit
                  </h5>
                  <form id="department_form" class="w-100 my-5 mx-auto" style="max-width: 170px;">
                    <div class="custom-control custom-radio">
                      <input 
                         checked
                         id="radio_1"
                        type="radio"
                         name="department"
                        value="sales_representative"
                         class="custom-control-input"
                       />
                      <label class="custom-control-label curp" for="radio_1">
                        Obchodní zástupce
                      </label>
                    </div>
                    <div class="custom-control custom-radio">
                      <input 
                         id="radio_2"
                        type="radio"
                         name="department"
                        value="technical_support"
                         class="custom-control-input"
                       />
                      <label class="custom-control-label curp" for="radio_2">
                        Technická podpora
                      </label>
                    </div>
                    <div class="custom-control custom-radio">
                      <input 
                         id="radio_3"
                        type="radio"
                         name="department"
                        value="financial_department"
                         class="custom-control-input"
                       />
                      <label class="custom-control-label curp" for="radio_3">
                        Finanční oddělení
                      </label>
                    </div>
                  </form>
                  <div class="text-center">
                    <button type="button" class="btn btn-link btn-back mt-0 d-inline-block">
                      Zpět
                    </button>
                    <button type="submit" form="department_form" class="btn btn-primary mt-0 d-inline-block">
                      Pokračovat
                    </button>
                  </div>
                  <!-- Second slide end -->
                  
                </div>
              </div>
            </div>
          </div>
          <div class="swiper-pagination swiper-no-swiping"></div>
        </div>
    </div>
  </div>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/js/bootstrap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.3.3/js/swiper.min.js"></script>
  <script src="https://unpkg.com/simplebar@3.1.0/dist/simplebar.js"></script>
  <script>
    var swiper = new Swiper('.swiper-container', {
      pagination: {
        el: '.swiper-pagination',
        dynamicBullets: true
      },
    });

    $('.btn-back').click(function(e) {
      swiper.slidePrev();
    })

    $('#main_form').submit(function(e) {
      e.preventDefault();
      swiper.slideNext();
    })

    $('#department_form').submit(function(e) {
      e.preventDefault();

      var name = $('#name').val();
      var email = $('#email').val();
      var phone = $('#phone').val();
      var department = $('input[name="department"]:checked').val()
      
      window.parent.postMessage({
        type: "SET_NAME",
        name: name
      }, "*");
      window.parent.postMessage({
        type: "SET_EMAIL",
        email: email
      }, "*");
      window.parent.postMessage({
        type: "SET_PHONE",
        phone: phone
      }, "*");
      window.parent.postMessage({
        type: "ADD_CUSTOM_DATA",
        name: "department",
        value: department
      }, "*");
      window.parent.postMessage({
        type: "ENQUEUE"
      }, "*");
    })
  </script>
</body>
</html>

You created an entry form using codepen.io. You have exported it to your computer. You have uploaded exported folders to the GitHub repository and then switched on the GitHub website. This brings you a link to our form, which you insert into the administration interface.

Last updated