client-side validation with javascript by daniel yee

15
Client-Side Validation with Javascript by Daniel Yee

Upload: ralph-murphy

Post on 26-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Client-Side Validation with Javascript by Daniel Yee

Client-Side Validation with Javascript

by

Daniel Yee

Page 2: Client-Side Validation with Javascript by Daniel Yee

Client-Side Scripting Language

• Javascript

• European Computer Manufacturers Association (ECMA)

• ECMA-262

• Third edition

• Updated Last December 1999

Page 3: Client-Side Validation with Javascript by Daniel Yee

Javascript

• Not a full fledged programming language

• Cannot connect to databases

• Limited interactions to system resources

• Cannot do tasks most web databases require

Page 4: Client-Side Validation with Javascript by Daniel Yee

Common Uses of Javascript

• Validation of <form> data

• Simple interaction with <form> data

• Adding dynamic elements to web page

Page 5: Client-Side Validation with Javascript by Daniel Yee

Benefits of using Javascript

• Faster response then using server-side validation

• Reduction in web-server load

• Reduction in network traffic

• Can be saved as a file - file.js and reused by typing <script type= text/javascript src=“file.js”>

Page 6: Client-Side Validation with Javascript by Daniel Yee

Warning!!!!!!!!!!!!!

• Never rely on client-side validation as the only method of ensuring requirements and constraints

• Javascript can be bypassed by the user through design, error, or configuration

Page 7: Client-Side Validation with Javascript by Daniel Yee

Validating <form> Data

• Simple example for validating a <form> with JavaScript

• Check for whitespace

Page 8: Client-Side Validation with Javascript by Daniel Yee

Batch Error Reporting

• Validation for multiple fields

• Batch error reporting

• Example

Page 9: Client-Side Validation with Javascript by Daniel Yee

Interactive Validation

• Password <form> validation

• Example

Page 10: Client-Side Validation with Javascript by Daniel Yee

Dynamic Elements

• Some implementations not associated with web database applications

• MouseOver

• Prefilled calculations

Page 11: Client-Side Validation with Javascript by Daniel Yee

MouseOver

• Creating a mouseOver Event

• Example

Page 12: Client-Side Validation with Javascript by Daniel Yee

Prefilled Calculations

• Shopping cart updating

• Example

Page 13: Client-Side Validation with Javascript by Daniel Yee

Conclusion

• Javascript is a client-side scripting language

• Can be used for validating forms and enhancing user interactions

• Benefits include improved speed, reduced load, and added features

Page 14: Client-Side Validation with Javascript by Daniel Yee

REMEMBER!!!!!

• NEVER USE AS THE ONLY METHOD TO ENSURE REQUIREMENTS, SECURITY, AND CONSTRAINTS

• WHY?

• BECAUSE IT CAN BE BYPASSED BY THE USER

Page 15: Client-Side Validation with Javascript by Daniel Yee

The End