Book Image

Instant Kendo UI Mobile

By : Sagar Ganatra
Book Image

Instant Kendo UI Mobile

By: Sagar Ganatra

Overview of this book

The Kendo UI Mobile library is a one stop solution to build mobile applications rapidly. It comes with several built-in widgets that enable application developers to build intuitive applications for small screen devices. It also provides more control to these developers by providing various components that can be extended or configured to match their needs. Instant Kendo UI Mobile How-to takes a deep look at various components of the Kendo UI Mobile library and provides solutions to common use cases involved in building a mobile application. It enables application developers to use HTML, CSS, and JavaScript to build mobile applications that provide a native look and feel on various platforms such as iOS, Android, and BlackBerry without having to maintain a separate code base. This guide introduces the user to the Kendo UI Mobile library and provides a step-by-step approach to creating your first mobile application. It then introduces you to several components and provides solutions to some of the common use cases you may encounter in your development. The Kendo UI Mobile library is composed of two parts – the aplication framework and a set of widgets. The aplication framework focuses on configuring the application, handling various touch-based events, rendering on different devices to provide a native look and feel, and transitioning from one view to the other. The widget library contains several widgets that enable you to build applications more rapidly than ever before.
Table of Contents (7 chapters)

Adding form elements to a mobile page (Simple)


Most mobile applications require data to be captured from the user input fields and they make use of forms. The Kendo UI Mobile framework allows you to add form elements to the page and provides styling for various platforms.

How to do it...

The mobile framework supports the adding of various types of input elements to the form such as text, password, e-mail, number, telephone, search, URL, date, time, month, and date time.

  1. Create an HTML document containing a form element.

  2. Add input fields of type text, password, email, date, and radio. The following is a sample markup that shows a form on a page:

    <div id="forms"
      data-role="view"
      data-title="Form Elements"
      data-layout="mobile-view">
    
      <form action="./index.html">
    
      <ul data-role="listview" data-style="inset">
    
        <li>
          <label>Full Name</label>
          <input type="text" placeholder="Full Name"/>  
        </li>
    
        <li>
          <label>Password</label>
          <input
            type="password"
          placeholder="Password" />
        </li>
    
        <li>
          <label>Email</label>
          <input
            type="email"
          placeholder="[email protected]" />
        </li>
    
        <li>
          <label>Date of Birth</label>
          <input type="date" />
        </li>
    
        <li>
          <label>Education</label>
          <select>
            <option value="Bachelors">
              Bachelors
            </option>
            <option value="Masters">
              Masters
            </option>
            <option value="Postgraduation">
              Post Graduation
            </option>
          </select>
        </li>
    
      </ul>
    
      <ul data-role="listview"
        data-style="inset" data-type="group">
        <li>Gender
        <ul>
        <li>
          <label>
            <input name="units" type="radio" checked="checked" />
          MALE</label>
        </li>
        <li>
          <label>
            <input name="units" type="radio" />
          FEMALE</label>
          </li>
        </ul>
        </li>
        <li>
          <button type="submit" data-role="button">Submit</button>
        </li>
        </ul>
      </form>
    </div>

How it works...

As seen in the previous markup, the form elements are added to the document, and when you run the same on a mobile device, the following output is shown:

If you have noticed the code snippet, we have made use of a new widget, ListView. The ListView widget is generally used when you have a list of elements to be shown on the page.

Next, you will learn about the various widgets that are available for use in building a Kendo mobile application.