Dreamweaver How to check the form

Source: Internet
Author: User
Tags numeric numeric value dreamweaver

This tutorial is about Dreamweaver checking form behavior and using the check form behavior to set a validation rule for each element in the form.

First, Dreamweaver check form behavior

1. Insert forms and Text fields in the document.

2. Repeat step 1th to add additional text fields.

3. Select the authentication method:

Select a text field if you want to validate each text field separately when the user fills out the form.

If you want to validate multiple text fields when the user submits the form, tap the label selector in the lower-left corner of the document window.

Label. If there is no label, first in the design window of the document, click the Red dotted box in the window to select the form and then select it in the lower left corner.

4. Open the Behavior panel.

5. Click the "Add behavior (+)" button, in the Pop-up Drop-down menu, select the "Check form" command, as shown in the following figure:

6. Open the Check Form dialog box, as shown in the following illustration:

7. Perform one of the following steps:

If you are validating only a single field, select the field from the fields list and the same name that you selected in the document window.

If you want to validate multiple fields, select a Text field from the Fields list.

8. If the field must contain some kind of data, select the required item in value.

9. Select the following options in the acceptable item:

Anything: Check that the field must contain data, but the data type is not limited.

Number: Check whether the field contains only numeric characters.

e-mail address: Check that the domain contains an @ symbol.

Number from: Checks whether the field contains a number in the specified range. Enter a numeric value in the following text box.

10. If you need to validate more than one field, in the Check Form dialog box, select another domain to validate in the field, and then repeat steps 8th and 9th.

11. Click "OK" button.

If you are validating multiple fields when the user submits the form, the OnSubmit event automatically appears in the Events menu.

If you are validating a single domain, check to see if the default event is a onblur or onchange event. If not, select the onblur or onchange event from the event Drop-down menu.

Onblur or onchange events are used to trigger the "check form" behavior when a user moves from the domain. The difference is that the onblur event occurs regardless of whether the user enters content in that field, and the onchange event occurs only when the user changes the contents of the domain.

Therefore, it is best to use the onblur event when the specified domain must fill out the content.

Change the message for the default check form in Dreamweaver

The following will change the English prompt in the Dreamweaver when the form is checked to the Chinese message.

1. Change the name and ID entries in the Text field to the appropriate Chinese name.

2. Modify "is required" to "cannot be null" or other information.

Cases

else if (test.charat (0) = = ' R ') errors + = '-' +nm+ ' is required. '; }

To

{}} else if (Test.charat (0) = = ' R ') errors + = '-' +nm+ ' cannot be empty. '; }

3. Modify "The following error (s) occurred:" to "prompt" or other information.

Cases

} if (Errors) alert (' The following error (s) occurred: ' +errors);

To

} if (Errors) alert (' Hint: ' +errors);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.