Session 6: Validating User Input. Outline Overview of User Input Validation Client-Side and Server-Side Validation ASP.NET Validation Controls Using Validation.

Slides:



Advertisements
Similar presentations
Asp.NET Core Vaidation Controls. Slide 2 ASP.NET Validation Controls (Introduction) The ASP.NET validation controls can be used to validate data on the.
Advertisements

web controls  standard controls  validation controls  rich controls.
DT211/3 Internet Application Development JSP: Processing User input.
Pertemuan 3 Server Side Scripting (ASP & ASP.Net) Matakuliah: T0053/Web Programming Tahun: 2006 Versi: 2.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Microsoft Visual Basic 2012 CHAPTER NINE Creating Web Applications.
ASP.NET Validating user input Validating user input on the client and/or server side 1ASP.NET Validating User Input.
ASP.NET Programming with C# and SQL Server First Edition
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Chapter 9 – Validating User Input Dr. Stephanos Mavromoustakos.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Module 7: Validating User Input.
.NET Validation Controls MacDonald Ch. 8 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
Chapter 3 Using Validation Controls. What is a Validation Control? A control that validates the value in another control Renders as an HTML tag with an.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Telerik Software Academy ASP.NET Web Forms Data Validation, Data Validators, Validation Groups Telerik Software Academy
Overview of Previous Lesson(s) Over View  Server controls are small building blocks of the graphical user interface, which includes  Text boxes  Buttons.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 3. 2 Overview Cookies Validation controls Client and server side validation Validation control examples.
ASP.Net Web Applications. Characteristics of a typical data driven web application Web Server HTML Graphics Active-X Java Applets HTTP Request ADO / JDBC.
Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital Media.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
BIT 285: ( Web) Application Programming Lecture 08: Thursday, January 29, 2015 Data Validation, Using Validators Instructor: Craig Duckett.
Validation and Rich controls 1www.tech.findforinfo.com.
Microsoft Visual Basic 2008 CHAPTER SEVEN Creating Web Applications.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
ASP.NET Event Handlers Database -> Browser ->Shopping Basket Validators.
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.
Lesson 12 Adding Validation To The Movie Database.
Module 4: Creating a Microsoft ASP.NET Web Form. Overview Creating Web Forms Using Server Controls.
Module 1: Working with ASP.NET. Overview Introducing ASP.NET Creating Web Forms Adding ASP.NET Code to a Page Handling Page Events Discussion: ASP vs.
AUC Technologies Projects Consulting, Development, Mentoring, and Training Company ASP.NET Validation Control Presented By : Muhammad Atif Hussain Deputy.
VALIDATION CONTROLS.  Validation Controls are primarily used to validate, or verify the data entered by user into a web form.  Validation controls attempt.
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
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.
® IBM Software Group © 2006 IBM Corporation Using JSF Mini-Calendar Controls This section describes how to use a JSF Mini-Calendar Control with EGL It.
Building Applications using ASP.NET and C# / Session 4 / 1 of 15 Session 4.
Chapter 9 進階 Web 控制項. 資料驗證 Web 控制項 RequireFieldValidator RequireFieldValidator
CSCI 4230 Homework #3 Group Three Samer Al Jefri * Kevin Odom * David Hood * JD * Phil.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 User Input Validating.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Vijayalakshmi G M Validation Controls.
CIS 375—Web App Dev II ASP.NET 4 Server Controls.
ASP + JavaScript Client and Server scripts. Link 1 function MyClick(){ document.write("MyClick"); } function MyFunction1(){ alert("My Function 1"); }
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
Beginning ASP.NET in C# and VB Chapter 9
Tutorial 6 Creating a Web Form
Using Personalization Creating user profiles Retrieving, changing, and saving profile properties Using validation controls Using the Forms Designer.
ASP.NET Part 2 Instructor: Charles Moen CSCI/CINF 4230.
Validation Controls Assist your users with providing the correct type of input for your application Assist your users with providing the correct type of.
Chapter 9 Validating User Input. Objectives What user input is and why it’s important to validate it What ASP.NET has to offer to aid you in validating.
JavaScript, Sixth Edition
Validation & Rich Controls
Validation Controls, User Controls, Master Pages
Web Application Web Application are programs that can be executed either on a Web server or in a Web browser. An Online store accessed through a browser.
Programming the Web Using ASP.Net
Creating Web Applications
Unit 27 - Web Server Scripting
12/9/2018 Session 9.1 Calendar and Validation Controls Using Sessions
JavaScript Form Validation
PART 2.
MIS 3200 – Unit 2.2 Outline What’s the problem with bad data?
Server Controls Validation Controls
.NET Validation Controls
Validation & Rich Controls
Presentation transcript:

Session 6: Validating User Input

Outline Overview of User Input Validation Client-Side and Server-Side Validation ASP.NET Validation Controls Using Validation Controls Input Validation Controls RequiredFieldValidator CompareValidator RangeValidator Other Validator Controls Page Validation

What Is Input Validation? Verifies that a control value is correctly entered by the user Blocks the processing of a page until all controls are valid Avoids spoofing or the addition of malicious code

Client-Side and Server-Side Validation ASP.NET can create both client-side and server-side validation Client-side validation Dependent on browser version Instant feedback Reduces postback cycles Server-side validation Repeats all client-side validation Can validate against stored data Valid? User Enters Data No Yes Error Message Client Server Web Application Processed

ASP.NET Validation Controls ASP.NET provides validation controls to: Compare values Compare to a custom formula Compare to a range Compare to a regular expression pattern Require user input Summarize the validation controls on a page

Adding Validation Controls to a Web Form 1.Add a validation control 2.Select the input control to validate 3.Set validation properties <asp:Type_of_Validator id="Validator_id" runat="server" ControlToValidate="txtName" ErrorMessage="Message_for_error_summary" Display="static|dynamic|none" Text="Text_to_display_by_input_control"> <asp:Type_of_Validator id="Validator_id" runat="server" ControlToValidate="txtName" ErrorMessage="Message_for_error_summary" Display="static|dynamic|none" Text="Text_to_display_by_input_control">

Positioning Validation Controls on a Web Form Create error messages Select display mode Static Dynamic

Combining Validation Controls Can have multiple validation controls on a single input control Only the RequiredFieldValidator checks empty controls

Input Validation Controls RequiredFieldValidator CompareValidator RangeValidator

The RequiredFieldValidator Control The RequiredFieldValidator is used to ensure that a required field is filled in by the user ControlToValidate (ID of field to validate) ErrorMessage (if ValidatorSummary is used) Text (error message to display) InitialValue (prompt visible in field)

The CompareValidator Control The CompareValidator is used to compare the value entered with (an)other value(s) ControltoValidate (ID of field to validate) ValueToCompare (value being compared) or ControlToCompare (ID of field being compared) Type (specifies data type to compare to) Operator (specifies type of comparison)

The RangeValidator Control RangeValidator ControlToValidate (ID of field to validate) MinimumValue (lower limit of range) MaximumValue (upper limit of range) Type (data type of field)

The RegularExpressionValidator Control Used when input must conform to a pre-defined pattern Visual Studio.NET includes patterns for: Telephone numbers Postal codes addresses <asp:RegularExpressionValidator … ControlToValidate="US_PhoneNumber"… ValidationExpression=" ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4} " …>* <asp:RegularExpressionValidator … ControlToValidate="US_PhoneNumber"… ValidationExpression=" ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4} " …>*

The CustomValidator Control Can validate on client-side, server-side, or both ClientValidationFunction OnServerValidate Validate with: Formula Data COM objects Web Service

The Page.IsValid Property Polls all validation controls Sub cmdSubmit_Click(s As Object, e As EventArgs) If Page.IsValid Then Message.Text = "Page is valid!" ' Perform database updates or other logic here End If End Sub Sub cmdSubmit_Click(s As Object, e As EventArgs) If Page.IsValid Then Message.Text = "Page is valid!" ' Perform database updates or other logic here End If End Sub

Using the ValidationSummary Control Collects error messages from all validation controls on the page Can display text and error messages Use Text="*" to indicate the location of the error <asp:ValidationSummary id="valSummary" runat="server" HeaderText="These errors were found:" ShowSummary="True" DisplayMode="List"/> <asp:ValidationSummary id="valSummary" runat="server" HeaderText="These errors were found:" ShowSummary="True" DisplayMode="List"/>