Controlling Data Entry Using Form Fields
Creating 'Encoded' Name & Value Pairs
Passing data from one form to another
Addressing Form Field Validation with Regular Expressions and JavaScript 1.2
You are here: irt.org | Articles | JavaScript | Form | Chapter 6: Beginning JavaScript [ previous next ]
Published on: Sunday 29th April 2001 By: Paul Wilton
Web pages would be very boring if we could not interact with the user, or obtain information from them, such as text, numbers, or dates. Luckily, with JavaScript we can. We can use this information within the web page, or it can be posted to the web server where we can manipulate it and store it in a database if we so wish. In this chapter we'll concentrate on using the information within the web browser, termed client-side processing. In Chapters 14 and 15, we'll see how to send this information to a web server and store it in a database, termed server-side processing.
When using your computer you'll be quite accustomed to various user interface elements. For example, the Windows operating system has a number of standard elements such as buttons you can click, lists, drop down list boxes, and radio buttons you can select from, and checkboxes you can tick. The same applies with any Graphical User Interface (GUI) operating system, whether it's on the Apple Mac, Unix, or Linux. These elements are the way we now interface with applications. The good news is that we can include many of these types of element in our web page and, even better, it's very easy to do so. Once we have such an element, say a button, inside our page we can then tie code to its events. For example, when the button is clicked, we can fire off a JavaScript function we've created.
It's important to note at this point that the elements I'm talking about in this chapter are the common elements made available by HTML, and not ActiveX elements, Java Applets or plug-ins. We'll look at some of these in Chapter 14.
All of the HTML elements used for interaction must be placed inside an HTML form. Let's start by taking a look at HTML forms and how we interact with them in JavaScript.
Controlling Data Entry Using Form Fields
Creating 'Encoded' Name & Value Pairs
Passing data from one form to another
Addressing Form Field Validation with Regular Expressions and JavaScript 1.2