Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Instant Kendo UI Mobile

You're reading from   Instant Kendo UI Mobile Practical recipes to learn the Kendo UI Mobile library and its various components for building mobile applications effectively

Arrow left icon
Product type Paperback
Published in Jul 2013
Publisher Packt
ISBN-13 9781849699112
Length 60 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Sagar Ganatra Sagar Ganatra
Author Profile Icon Sagar Ganatra
Sagar Ganatra
Arrow right icon
View More author details
Toc

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="username@domain.com" />
        </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.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime