ABOUT VALIDATING FORM DATA


To validate form data to determine whether all required fields have been entered, you need to perform a procedure known as forms validation. It can be done on the server side, where an application running on your web server checks the submitted data for validity and returns an error page if all is not well. However, it's often easier to run this procedure on the client side, using JavaScript forms validation.

When the Submit button is clicked, a JavaScript will first execute to check the contents of the form fields against criteria that you've specified for each field. If any required fields are empty, or any fields contain data not formatted correctly, a friendly error dialog appears, and the form is not submitted. This ensures that any form that is submitted is full and correct. Use GoLive's Action palette to create your own form validation:

1.

Choose Window, Actions to display the Actions palette.

2.

Click the F icon that represents the form tag in your document window to select the form.

3.

In the Actions palette, scroll down in the Events list and select Form Submit, as shown in Figure 39.26.

Figure 39.26. The Form Submit action enables you to create an action that is triggered when the Submit button is clicked.


4.

Click the Create New Action button in the Actions palette to create a new action in the Actions column, as shown in Figure 39.27.

Figure 39.27. All of the available actions are found under the Action button, which becomes available after you select an event from the Actions palette.


5.

From the Action pop-up menu, select Getters, Field Validator, as shown in Figure 39.28.

Figure 39.28. The Getters options pertain to forms specifically.


6.

In the Actions palette, select from the pop-up menus to specify your field validation, as shown in Figure 39.29.

Figure 39.29. Add a Field Validator action for each field you want to validate.


7.

Click the Create New Action button to add additional fields you want to validate and then test your form in a browser. A dialog box appears when the form validation is not met.




Special Edition Using Adobe Creative Suite 2
Special Edition Using Adobe Creative Suite 2
ISBN: 0789733676
EAN: 2147483647
Year: 2005
Pages: 426
Authors: Michael Smick

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net