WAD
Adding Server Behaviors to your Pages
Working with FormsProviding a login page for your users restricts access to the site—and the ability to modify records in the database—to those who have permission. One of the many Dreamweaver server behaviors we’ll explore is the User Authentication Server Behavior, which creates a login page and verifies users’ entries.
When users submit data to your database, they’ll do so by entering information into form fields. For the user login page, we’ll create a simple form that collects a user name and password:
- In Design view, place your cursor at the top of the login.asp page. On the Insert bar, select the Forms tab and then click the Form
button.Dreamweaver creates an empty form on the page, represented by a dashed red line:

You can see the
- Enter a name for the form into the Form name field, such as frmLogin.
- Normally, you’d enter an action for the form, such as a URL where the form should submit the data, but the User Authentication Server Behavior we’re going to add will do this for us. The URL will depend on whether or not the login is successful. For now, leave this field empty.
- Leave the default method as POST. Normally, you’ll use the POST method with the ASP Request.Form statement when passing data from one page to another. The GET method relies on passing querystrings, which are visible to the user in the browser.
- Next, insert a table inside the form with two columns and two rows.
- In the first row, enter “User Name” into the first column. In the second row, enter “Password” into the first column.
- Position your cursor in the first row, second column of the table. On the Forms tab of the Insert bar, click the Text Field
button to insert a text field. Do the same for the second row, second column. - Position your cursor outside the table, press Enter, and then, on the Forms tab of the Insert bar, click Button
to insert a submit button. - Click on the first text field and look at the Property Inspector:
- Save the login.asp page.
Your form should now look something like this:


Here, you define the properties of the selected form field. We should give each text field an identifiable name. We’ll call the first text field “txtUserName”. We don’t need to define any other properties for it.
Next, we’ll select the second text field and enter the name “txtPassword”. Notice that Dreamweaver includes a Password property, which masks the text typed into the field. Select this property for the password field. The Property Inspector for the second text field should now look like this:

No comments:
Post a Comment