>> Form Data Validation in JavaScript

Slides:



Advertisements
Similar presentations
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Advertisements

CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
Tutorial 6 Creating a Web Form
Ch3: Introduction to HTML5 part 2 Dr. Abdullah Almutairi ISC 340 Fall 2014.
Chapter 6 Basic forms 1. Forms and query string 2 form : a group of user input (UI) controls that accepts information from the user and sends the information.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
HTML Tables and Forms Creating Web Pages with HTML CIS 133 Web Programming Concepts 1.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Web Programming – Java Script Association of Computing Activities Computer Science and Engineering Indian Institute of Technology Kanpur.
JavaScript Form Validation
Building the User Interface by Using HTML5: Organization, Input, and Validation Lesson 3.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
© 2011 Delmar, Cengage Learning Chapter 9 Collecting Data with Forms.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
Neal Stublen Improvements  New form elements  Assist with validation  Consistency across sites  Changes reduce the need for common.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
HTML. Basic HTML HTML document – HTML headings – to HTML paragraphs – HTML links – HTML images –
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Introduction to JavaScript CS101 Introduction to Computing.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
>> More on CSS Selectors. Pre-requisite Open the file called sample.txt Copy the all the text from the file Open your browser and go to codepen.io Paste.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Event-Driven Programming Chapter Page Section: Section or division of an HTML page Generic block element Example: What's the difference between.
MIMOS Berhad. All Rights Reserved. Nazarudin Wijee Mohd Sidek Salleh Grid Computing Lab MIMOS Berhad P-GRADE Portal Heuristic Evaluation.
Looking at various Rich Message options in KRAD Kuali University: Apply Now Lab : Rich Messages Lab Objectives Understand what Rich Messages are and how.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
HTML 5 Form elements Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Making web pages interactive with JavaScript.
Tutorial 6 Creating a Web Form
XHTML Forms.
JavaScript, Sixth Edition
IS1500: Introduction to Web Development
>> JavaScript: Document Object Model
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Web Development & Design Foundations with HTML5
>> Introduction to CSS
>> The “Box” Model
EXCEPTION HANDLING IN SERVER CLIENT PROGRAMMING
Web Development & Design Foundations with HTML5 7th Edition
Web Programming– UFCFB Lecture 17
Intro to PHP & Variables
Validation and Building Small Apps
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Objectives Explore web forms Work with form servers
Unit 27 - Web Server Scripting
Embedded with tags..
Displaying Form Validation Info
JavaScript Introduction
>> Dynamic CSS Selectors
Tutorial 6 Creating Dynamic Pages
JavaScript Form Validation
HTML5 and Local Storage.
HTML5 - 2 Forms, Frames, Graphics.
PHP-II.
Introduction to JavaScript
© 2017, Mike Murach & Associates, Inc.
Presentation transcript:

>> Form Data Validation in JavaScript

Web-based Systems | Misbhauddin When Form Validation Upon Submit As you type Top/Bottom Beside Each What Where ToolTip Format Confirmation Required Message How Visual Property Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Validation Types * On required fields Beside the fields Text disappears on typing Popup tool tips © Smashing Magazine Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin When? Validation upon Submit Classic way - user submits his data via the “submit” button Typical technique for server-side validation Instant Validation (Real-time/as you type) Alerts users while they are filling in the form Key: field loses focus Changing the color of field labels Providing error tips (balloons) next to each field Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin What? Required fields Ensure that the user provided all the necessary details in the web form A common way to mark required fields is with an asterisk (*) Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin What? Correct format Applies to various cases such as email address, URL, dates, phone numbers and others Use regular expressions (not in the scope) Do not impose a strict input pattern on the users – interpret intelligently Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin What? Confirmation fields Let the users confirm their input using additional confirmation fields Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin How? Error Message Provide a clear and unambiguous message Preferably in red color Should contain an appropriate icon Visual / Location Red inline messages or markers next to every invalid field Changing the background color or border color of invalid fields Changing the color of field labels Providing error tips (balloons) next to each field Note: It is a good idea to have hints as the initial value of your input fields. Hint will disappear after user starts typing the data. Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Where? Error Message Location Top/Bottom for all errors upon pressing the “submit” button (Single Span Tag to hold the error message) Beside each element (Span Tag beside each element) Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Exercise Go Online and download the HTML page named “facultyForm.html” Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin When Try Now Complete the function in the script tag Alert user with message “Form Submitted” <script type=“text/javascript”> </script> Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Error Notice the span tag after each form element. They have the same class (error) and a unique id Each Span has an appropriate message Span is styled such that Red Color (color property) Italics (Slanted) (font-style property) View it in the browser Make them disappear (Hint: Use visibility: hidden) Try Now Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Modifying CSS Get a handle on the element var elem = document.getElementById(“……"); 2. Use “style” object to set the property elem.style.visibility = "visible"; Note: If the property has a “-” in the name such as background-color Remove the hiphen (-) Capitalize the first letter of the second word backgroundColor 2. Can also use the setAttribute function  elem.setAttribute("style",“visibility: visible"); Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Now Add function If a value is missing then display the error message Use “” to identify an empty string Note: “” is different from “ “ “” is empty string “ “ is a space 2. Change other properties if you wish to like the background color or the border color Try Now Web-based Systems | Misbhauddin