Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

jQuery Mobile Tutorial: User Registration, Login and Logout Screens for the Meeting Room Booking App

DZone's Guide to

jQuery Mobile Tutorial: User Registration, Login and Logout Screens for the Meeting Room Booking App

· Mobile Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

In this jQuery Mobile tutorial we will create the screens that will handle user registration, login and logout in a real-world Meeting Room Booking application. This article is part of a series of mobile application development tutorials that I have been publishing on my blog jorgeramon.me.

signup-scrn-2

If you are new to this series, I recommend that you read its first part, as well as thismobile UI patterns article where I provide a flowchart describing the user registration, login and logout screens in a mobile application. We will use this chart as a guide for this article. Here’s a screenshot:

screen-flow-login-or-register-small

In this part of the tutorial we will only create the static HTML for the screens. In future articles we will implement the programming logic that makes the pages work.

The first step we are going to take is to set up a jQuery Mobile project for the app.

How to Set Up a jQuery Mobile Project

While you can use mobile SDKs such as Kendo UI Mobile and Intel XDK to create, debug and deploy jQuery Mobile apps, in this tutorial I will show you how to create a simple jQuery Mobile project without using the facilities provided by those SDKs. I think that it’s important to understand how you can create this type of project from scratch, and how the different pieces in the project work together in an app.

The Project’s Directories and Files

We need to pick a directory in our development workstations where we will place the project’s files. In my case I named that directory “apps”. In that directory, we will create a root directory for the application, which we will name “conf-rooms”. Make sure that this directory is set up so it can be accessed from your local web server.

Under “conf-rooms” we will create a “css” directory, where we will place the css assets of the project; and an “img” directory for the images that we will use.

At the same level of the “apps” directory, we will create a “lib” directory. This is where we will place the jQuery Mobile and any other libraries that our application will use. You also need to set up this directory so it can be accessed from your local web server.

On my workstation the directories look as depicted below:

directories-1

Now is a good time to download the jQuery Mobile and jQuery libraries from their respective websites, and place them in the “jqm” and “jquery” directories, all under the “lib” directory. This is how the files look on my workstation:

directories-2

How jQuery Mobile Works

A short overview of jQuery Mobile for those who aren’t very familiar with it yet. As its documentation clearly explains, jQuery Mobile is a unified user interface system with the following characteristics:

  • It works seamlessly across all popular mobile device platforms.
  • It uses jQuery and jQuery UI as its foundations.
  • It has a lightweight codebase built on progressive enhancement.
  • It has a flexible and easily themeable design.

An attribute that differentiates jQuery Mobile from other frameworks is that it targets a wide variety of mobile browsers. The reason this coverage is possible has to do with the way jQuery Mobile works.

jQuery Mobile works by applying CSS and JavaScript enhancements to HTML pages built with clean, semantic HTML. The usage of semantic HTML ensures compatibility with most web-enabled devices. The techniques applied by the Framework to an HTML page, transform the semantic page into a rich and interactive experience. We call these changes progressive enhancements, as they are applied progressively to the page, taking advantage of the capabilities of the browser on the web-enabled device.

The enhancements result in pages that provide a great user experience on the latest mobile browsers and degrade gracefully on less capable browsers, without losing their intrinsic functionality.

In addition, the Framework provides support for screen readers and other assistive technologies through a tight integration with the Web Accessibility Initiative – Accessible Rich Internet Applications Suite (WAI-ARIA) technical specification.

Creating the Landing Screen

The first application that we will create is the Landing Screen. This screen will come up when users launch our application. As reflected in the flowchart at the beginning of this article, the Landing Screen is the door to all the areas of the app, and it requires that users log in before navigating any further.

In the “Wireframes for Signing In and Signing Up” section of the third part of this tutorial we created the following mockup for this screen.

start-screen-1

Let’s create an empty index.html file in the “conf-rooms” directory, and add a jQuery Mobile page template to the file as follows:

<!DOCTYPE html>
<html>
<head>
    <title>Conference Room Booking App - Welcome</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
    <link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
    <link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script src="../../lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
    <script src="../../lib/jqm/1.4.4/jquery.mobile-1.4.4.min.js"></script>
</head>

<body>
    <div data-role="page">
        <div data-role="header" data-theme="c">
            <h1>Book It</h1>
        </div><!-- /header -->
        <div role="main" class="ui-content">
            <h2 class="mc-text-center">Welcome!</h2>
            <p class="mc-top-margin-1-5"><b>Existing Users</b></p>
            <a href="sign-in.html" class="ui-btn ui-btn-b ui-corner-all">Sign In</a>
            <p class="mc-top-margin-1-5"><b>Don't have an account?</b></p>
            <a href="sign-up.html" class="ui-btn ui-btn-b ui-corner-all">Sign Up</a>
            <p></p>
        </div><!-- /content -->
    </div><!-- /page -->
</body>
</html>

Before we step through this code I want you to check out this file in a mobile browser or simulator. The result should look like this screenshot:

landing-scrn-2

What do you think?

Back in the index.html file, in the head section we have references to the jQuery and jQuery Mobile libraries. Double check that yours are pointing to the correct directories in your workstation.

How to Use a Custom Theme in jQuery Mobile

Now I want to direct your attention to the following lines:

<link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
<link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
<link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />

These lines mean that we are using a custom jQuery Mobile theme that resides in the “conf-room1.min.css” file. I created this file using jQuery Mobile’s Theme Roller. We will use this theme to give our app a look different than the standard jQuery Mobile themes.

You can download the theme using this link. After downloading the zipped theme files, we will go to the “css” directory, create a “css/themes/1″ directory and place the unzipped theme files there. When done, the “css” directory should look like this:

directories-3

In the head section of the index.html file we also have this code:

<link href="css/app.css" rel="stylesheet" />

App.css is the css file where we will place any additional custom styles that we will use in the app. For the moment, we will add the following code to the “app.css” file:

/* Change html headers color */
h1,h2,h3,h4,h5 {
    color:#0071bc;
}
h2.mc-text-danger,
h3.mc-text-danger  {
    color:red;
}

/* Change border radius of icon buttons */
.ui-btn-icon-notext.ui-corner-all {
    -webkit-border-radius: .3125em;
    border-radius: .3125em;
}
/* Change color of jQuery Mobile page headers */
.ui-title {
    color:#fff;
}
/* Center-aligned text */
.mc-text-center {
    text-align:center;
}
/* Top margin for some elements */
.mc-top-margin-1-5 {
    margin-top:1.5em;
}

These are just a few cosmetic changes that will enhance the look of the app. Notice that I prefixed non-jQueryMobile classes with the characters “mc-” to avoid potential collisions with jQueryMobile’s classes.

The remaining lines in the head section of index.html are the references to the jQuery and jQuery Mobile libraries. As I suggested earlier, make sure that yours are pointing to the correct directories in your project.

Let’s move on to the body section of the “index.html file”. There you will find the standard jQuery Mobile page template with a header and main divs:

<div data-role="page">
    <div data-role="header" data-theme="c">
        <h1>Book It</h1>
    </div><!-- /header -->
    <div role="main" class="ui-content">
        <h2 class="mc-text-center">Welcome!</h2>
        <p class="mc-top-margin-1-5"><b>Existing Users</b></p>
        <a href="sign-in.html" class="ui-btn ui-btn-b ui-corner-all">Sign In</a>
        <p class="mc-top-margin-1-5"><b>Don't have an account?</b></p>
        <a href="sign-up.html" class="ui-btn ui-btn-b ui-corner-all">Sign Up</a>
        <p></p>
    </div><!-- /content -->
</div><!-- /page -->

We have decorated the “header” div with the data-theme=”c” attribute, which gives it the nice purple background color that we defined in the custom theme:

header-1

In the “main” div we are using a couple of links to the Sign In and Sign Up screens respectively. The links point to the sign-in.html and sing-up.html files that we will create in a few minutes.

These links are decorated with the jQuery Mobile ui-btn, ui-btn-b and ui-corner-all classes, which make them look like buttons:

landing-scrn-2

This is all we need to do in the Lading Page for the moment. Let’s move on to the Log In Screen.

Creating a Log In Screen with jQuery Mobile

Here’s the Log In Screen’s mockup that we built in the third part of this tutorial:

sign-in-screen-1

We will use the Log In Screen to capture the user’s credentials and validate them against the application’s user accounts database. If validation succeeds, we will direct users to a “Main Menu” scree that we will create in an upcoming tutorial.

Let’s create an empty sign-in.html file in the project’s directory. In the file, we will write the following code:

<!DOCTYPE html>
<html>
<head>
    <title>Conference Room Booking App - Sign In</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
    <link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
    <link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script src="../../lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
    <script src="../../lib/jqm/1.4.4/jquery.mobile-1.4.4.min.js"></script>
</head>

<body>
    <div data-role="page">
        <div data-role="header" data-theme="c">
            <h1>Book It</h1>
        </div><!-- /header -->
        <div role="main" class="ui-content">
            <h3>Sign In</h3>
            <label for="txt-email">Email Address</label>
            <input type="text" name="txt-email" id="txt-email" value="">
            <label for="txt-password">Password</label>
            <input type="password" name="txt-password" id="txt-password" value="">
            <fieldset data-role="controlgroup">
                <input type="checkbox" name="chck-rememberme" id="chck-rememberme" checked="">
                <label for="chck-rememberme">Remember me</label>
            </fieldset>
            <a href="#dlg-invalid-credentials" data-rel="popup" data-transition="pop" data-position-to="window" id="btn-submit" class="ui-btn ui-btn-b ui-corner-all mc-top-margin-1-5">Submit</a>
            <p class="mc-top-margin-1-5"><a href="begin-password-reset.html">Can't access your account?</a></p>
            <div data-role="popup" id="dlg-invalid-credentials" data-dismissible="false" style="max-width:400px;">
                <div role="main" class="ui-content">
                    <h3 class="mc-text-danger">Login Failed</h3>
                    <p>Did you enter the right credentials?</p>
                    <div class="mc-text-center"><a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-b mc-top-margin-1-5">OK</a></div>
                </div>
            </div>
        </div><!-- /content -->
    </div><!-- /page -->
</body>
</html>

If you open this sign-in.html with a mobile browser or emulator, you will see something like this:

signin-scrn-2

The head section of the html document is similar to the index.html file we created a few minutes ago, with the exception of the document’s title. No need to explain much there.

In the “main” section of the jQuery Mobile page that wee added to the file, we dropped a few controls that will allow us to capture the user’s email and password, along with a checkbox that will let us know when the user wants the app to remember their credentials:

<h3>Sign In</h3>
<label for="txt-email">Email Address</label>
<input type="text" name="txt-email" id="txt-email" value="">
<label for="txt-password">Password</label>
<input type="password" name="txt-password" id="txt-password" value="">
<fieldset data-role="controlgroup">
    <input type="checkbox" name="chck-rememberme" id="chck-rememberme" checked="">
    <label for="chck-rememberme">Remember me</label>
</fieldset>
<a href="#dlg-invalid-credentials" data-rel="popup" data-transition="pop" data-position-to="window" id="btn-submit" class="ui-btn ui-btn-b ui-corner-all mc-top-margin-1-5">Submit</a>
<p class="mc-top-margin-1-5"><a href="begin-password-reset.html">Can't access your account?</a></p>

We also added a link that will allow users to initiate the password reset process if they have problems logging in.

You will also notice that the “Submit” link points to the “dlg-invalid-credentials” anchor defined in the same jQuery Mobile page. This link is decorated with the data-rel=”popup”, data-transition=”pop” and data-position-to=”window” attributes. When we do this, we are telling jQuery Mobile to open the link to the element with id=”dlg-invalid-credentials” as a popup dialog, using a “pop” transition, and center the element relative to the document’s window. Here’s the html for the popup:

<div data-role="popup" id="dlg-invalid-credentials" data-dismissible="false" style="max-width:400px;">
    <div role="main" class="ui-content">
        <h3 class="mc-text-danger">Login Failed</h3>
        <p>Did you enter the right credentials?</p>
        <div class="mc-text-center"><a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-b mc-top-margin-1-5">OK</a></div>
    </div>
</div>

Notice that the “dlg-invalid-credentials” div is decorated with the data-rel=”popup” attribute, signaling to jQuery Mobile to apply popup styles to this div. If you click or tap the “submit” button, you will see the “Invalid Credentials” popup:

login-failed-scrn-2

One last thing on this screen. We have the popup linked directly to the “Submit” button for testing purposes. In an upcoming part of this tutorial we will add programming logic that will activate the popup only when the login fails.

For the moment we are only concerned with creating the html code for the pages and making sure that the jQuery Mobile enhancements work on them.

Creating an Account Locked Screen with jQuery Mobile

Many business applications use an Account Locked feature as a measure to increase the app’s security. We will use this feature in our app, and this means that we need to create an Account Locked screen. The purpose of the screen is to notify the user that their account is locked. We will define under which conditions an account will be locked through programming logic that we will add in an upcoming chapter of this tutorial.

Let’s create an empty account-locked.html file, and drop the following code in it:

<!DOCTYPE html>
<html>
<head>
    <title>Conference Room Booking App - Account Locked</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
    <link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
    <link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script src="../../lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
    <script src="../../lib/jqm/1.4.4/jquery.mobile-1.4.4.min.js"></script>
</head>

<body>
    <div data-role="page">
        <div data-role="header" data-theme="c">
            <a href="sign-in.html" data-rel="back" class="ui-btn-left ui-btn  ui-btn-icon-notext ui-corner-all ui-icon-back">Back</a>
            <h1>App Name</h1>
        </div><!-- /header -->
        <div role="main" class="ui-content">            
            <h2 class="mc-text-danger">Your Account is Locked</h2>
        <p>Please contact the <a href="mailto:">HelpDesk</a> to resolve this issue.</p>
        </div><!-- /content -->
    </div><!-- /page -->
</body>
</html>

The file should look like the screenshot below when viewed with a mobile browser or emulator:

account-locked-scrn-2

The html code for this screen is very similar to that in the prior two screens, with the exception of one element that I want you to pay attention to:

<div data-role="header" data-theme="c">
    <a href="sign-in.html" data-rel="back" class="ui-btn-left ui-btn  ui-btn-icon-notext ui-corner-all ui-icon-back">Back</a>
    <h1>App Name</h1>
</div><!-- /header -->

The header section of the jQuery Mobile page we just created contains a link to the sign-in.html file. When we decorate it with the ui-btn-left, ui-btn, ui-btn-icon-notext, ui-corner-all and ui-icon-back classes, we are giving the link the appearance of a toolbar button, just like this:

back-btn-1

The data-rel=”back” attribute causes any taps on the anchor to mimic a “back button”, going back one history entry and ignoring the anchor’s default href.

You can read more about navigation and linking on jQuery Mobile by visiting jQuery Mobile’s navigation documentation. You should also visit the jQuery Mobile buttons guide to learn about how to create buttons.

Creating a Sign Up Page With jQuery Mobile

When users tap on the Landing Screen’s “Sign Up” button, they will open the Sign Up Screen. This is where we will capture the user’s personal information so we can create an account for them.

Remember that our mockup of the Sign Up Screen looks like this:

sign-up-screen-1

Let’s create an empty sign-up.html file and add the following code to it:

<!DOCTYPE html>
<html>
<head>
    <title>Conference Room Booking App - Sign Up</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
    <link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
    <link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script src="../../lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
    <script src="../../lib/jqm/1.4.4/jquery.mobile-1.4.4.min.js"></script>
</head>

<body>
<div data-role="page">
    <div data-role="header" data-theme="c">
        <h1>Book It</h1>
    </div><!-- /header -->
    <div role="main" class="ui-content">
        <h3>Sign Up</h3>
        <label for="txt-first-name">First Name</label>
        <input type="text" name="txt-first-name" id="txt-first-name" value="">
        <label for="txt-last-name">Last Name</label>
        <input type="text" name="txt-last-name" id="txt-last-name" value="">
        <label for="txt-email">Email Address</label>
        <input type="text" name="txt-email" id="txt-email" value="">
        <label for="txt-password">Password</label>
        <input type="password" name="txt-password" id="txt-password" value="">
        <label for="txt-password-confirm">Confirm Password</label>
        <input type="password" name="txt-password-confirm" id="txt-password-confirm" value="">
        <a href="#dlg-sign-up-sent" data-rel="popup" data-transition="pop" data-position-to="window" id="btn-submit" class="ui-btn ui-btn-b ui-corner-all mc-top-margin-1-5">Submit</a>
        <div data-role="popup" id="dlg-sign-up-sent" data-dismissible="false" style="max-width:400px;">
            <div data-role="header">
                <h1>Almost done...</h1>
            </div>
            <div role="main" class="ui-content">
                <h3>Confirm Your Email Address</h3>
                <p>We sent you an email with instructions on how to confirm your email address. Please check your inbox and follow the instructions in the email.</p>
                <div class="mc-text-center"><a href="sign-in.html" class="ui-btn ui-corner-all ui-shadow ui-btn-b mc-top-margin-1-5">OK</a></div>

            </div>
        </div>
    </div><!-- /content -->
</div><!-- /page -->

</body>
</html>

The file should look as depicted below when you open it with a mobile browser or emulator:

signup-scrn-2

The only difference with the mockup is that we are using a “Submit” button at the bottom of the screen, instead of a “Done” button in the toolbar. When you examine the html code, you will find that the “Submit” button is wired to the “dlg-sign-up-sent” popup:

<div data-role="popup" id="dlg-sign-up-sent" data-dismissible="false" style="max-width:400px;">
    <div data-role="header">
        <h1>Almost done...</h1>
    </div>
    <div role="main" class="ui-content">
        <h3>Confirm Your Email Address</h3>
        <p>We sent you an email with instructions on how to confirm your email address. Please check your inbox and follow the instructions in the email.</p>
        <div class="mc-text-center"><a href="sign-in.html" class="ui-btn ui-corner-all ui-shadow ui-btn-b mc-top-margin-1-5">OK</a></div>

    </div>
</div>

If you tap on the button, the popup will become visible:

confirm-email-dlg-2

We will use this popup to notify the users that we have sent them a message asking them to confirm their email address. The message will contain a link to a webpage where users will need to re-enter the email address used to create their account in the app. With this step we are trying to make sure that it was is a human with a valid email inbox who created the account.

Back in the popup’s html code, notice how the “OK” button links back to the Sign In Screen. You should be able to confirm that this link works when you tap the button.

Creating a Password Reset Screen with jQuery Mobile

The app’s Landing Screen has a “Can’t access your account?” link that helps user initiate the password reset workflow of the app. The first step of this workflow is to present the “Begin Password Reset” Screen to the user. We will use this screen to capture the user’s email address. If we find this email address in the user accounts database of the app, we will email the user a provisional password. Next, we will activate the “End Password Reset” screen, where the user will need to enter the provisional password and a new password of their choosing. The picture below illustrates this process.

scrns-pwd-reset.-only

Let’s create an empty begin-password-reset.html file in the project’s directory. We will write the following code int the file:

<!DOCTYPE html>
<html>
<head>
    <title>Conference Room Booking App - Password Reset</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
    <link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
    <link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script src="../../lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
    <script src="../../lib/jqm/1.4.4/jquery.mobile-1.4.4.min.js"></script>
</head>

<body>
    <div data-role="page">
        <div data-role="header" data-theme="c">
            <h1>Book It</h1>
        </div><!-- /header -->
        <div role="main" class="ui-content">
            <h3>Password Reset</h3>
            <label for="txt-email">Enter your email address</label>
            <input type="text" name="txt-email" id="txt-email" value="">
            <a href="#dlg-pwd-reset-sent" data-rel="popup" data-transition="pop" data-position-to="window" id="btn-submit" class="ui-btn ui-btn-b ui-corner-all mc-top-margin-1-5">Submit</a>
            <div data-role="popup" id="dlg-pwd-reset-sent" data-dismissible="false" style="max-width:400px;">
                <div data-role="header">
                    <h1>Password Reset</h1>
                </div>
                <div role="main" class="ui-content">
                    <h3>Check Your Inbox</h3>
                    <p>We sent you an email with instructions on how to reset your password. Please check your inbox and follow the instructions in the email.</p>
                    <div class="mc-text-center"><a href="end-password-reset.html" class="ui-btn ui-corner-all ui-shadow ui-btn-b mc-top-margin-1-5">OK</a></div>
                </div>
            </div>
        </div><!-- /content -->
    </div><!-- /page -->
</body>
</html>

This is how the screen should look when viewed on a mobile browser or emulator:

begin-pwd-reset-scrn-2

There is nothing new in the html code of this screen. We wired the “Submit” button so when a user taps it, the embedded “dlg-pwd-reset-sent” popup will become active:

pwd-reset-dlg-2

We did this for testing purposes. Remember that we will add the programming logic that activates these popups in upcoming chapters of this tutorial.

When a user taps the popup’s “OK” button, the application will navigate to the “End Password Reset” Screen, which we will create next.

The End Password Reset Screen

This is the screen where the user will enter the provisional password we sent them via email, along with a new password of their choosing. To create this screen we will add an empty “end-password-reset.html” file to the project. Here’s the code that goes in the file:

<!DOCTYPE html>
<html>
<head>
    <title>Conference Room Booking App - Password Reset</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
    <link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
    <link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script src="../../lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
    <script src="../../lib/jqm/1.4.4/jquery.mobile-1.4.4.min.js"></script>
</head>

<body>
    <div data-role="page">
        <div data-role="header" data-theme="c">
            <h1>Book It</h1>
        </div><!-- /header -->
        <div role="main" class="ui-content">
            <h3>Reset Password</h3>
            <label for="txt-tmp-password">Provisional Password</label>
            <input type="password" name="txt-tmp-password" id="txt-tmp-password" value="">
            <label for="txt-new-password">New Password</label>
            <input type="password" name="txt-new-password" id="txt-new-password" value="">
            <label for="txt-new-password-confirm">Confirm New Password</label>
            <input type="password" name="txt-new-password-confirm" id="txt-new-password-confirm" value="">
            <a href="#dlg-pwd-changed" data-rel="popup" data-transition="pop" data-position-to="window" id="btn-submit" class="ui-btn ui-btn-b ui-corner-all mc-top-margin-1-5">Submit</a>
            <div data-role="popup" id="dlg-pwd-changed" data-dismissible="false" style="max-width:400px;">
                <div data-role="header">
                    <h1>Done</h1>
                </div>
                <div role="main" class="ui-content">
                    <p>Your password was changed.</p>
                    <div class="mc-text-center"><a href="sign-in.html" class="ui-btn ui-corner-all ui-shadow ui-btn-b mc-top-margin-1-5">OK</a></div>

                </div>
            </div>
        </div><!-- /content -->
    </div><!-- /page -->

</body>
</html>

The screen should look like the picture below when viewed with a mobile browser or emulator:

end-pwd-reset-scrn-2

We wired the “Submit” button so it activates the embedded “dlg-pwd-changed” popup:

pwd-changed-dlg-2

This popup simply tells the user that their password was changed. Tapping the “OK” button will make the app navigate back to the Sign In Screen, where the user can sign in with the new password.

Summary and Next Steps

This concludes our first phase of work on the user registration, login and logout screens of the jQuery Mobile version of the app. I will emphasize again that in this phase we are not adding programming logic to the screens. We are simply creating a jQuery Mobile page for each screen and making sure that the visual elements within the screens adhere to the mockups that we created in previous chapters of this tutorial, as well as to the UI patterns flowchart that I mentioned at the beginning of this article.

While we’ve made significant progress with the app at this point, it’s fair to say that we are just getting started. We are still missing the programming for this article’s screens, as well as the jQuery Mobile pages and programming for the screens that will allow users to browse and reserve meeting rooms, which is why we created the app in the first place.

In the next chapter of this tutorial we will get started with the programming of the user profile screens we just created. Don’t forget to sign up for my mailing list so you can be among the first to know when I publish the next update.

Stay Tuned

Don’t miss any articles. Get new articles and updates sent free to your inbox.

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda

Topics:
mobile ,jquery mobile ,cross platform

Published at DZone with permission of Jorge Ramon, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}