Build a registration page in Dreamweaver

Opomba:

The user interface has been simplified in Dreamweaver CC and later. As a result, you may not find some of the options described in this article in Dreamweaver CC and later. For more information, see this article.

About registration pages

Your web application can contain a page that requires users to register the first time they visit your site.

A registration page is made up of the following building blocks:

  • A database table to store login information about the users

  • An HTML form that lets users select a user name and password

    You can also use the form to obtain other personal information from users.

  • An Insert Record server behavior to update the database table of site users

  • A Check New Username server behavior to make sure the user name entered by the user is not taken by another user

Store login information about users

A registration page requires a database table to store the login information entered by users.

  • Make sure your database table contains a user name and a password column. If you want logged‑in users to have different access privileges, include an access privilege column.
  • If you want to set a common password for all users of the site, configure your database application (Microsoft Access, Microsoft SQL Server, Oracle, and so on) to enter the password in each new user record by default. In most database applications, you can set a column to a default value each time a new record is created. Set the default value to the password.
  • You can also use the database table to store other useful information about the user.

    The next step in creating a registration page is to add an HTML form to the registration page to let users choose a user name and password (if applicable).

Add an HTML form for selecting a user name and password

You add an HTML form to the registration page to let users select a user name and password (if applicable).

  1. Create a page (File > New > Blank Page) and lay out your registration page using the Dreamweaver design tools.
  2. Add an HTML form by placing the insertion point where you want the form to appear and selecting Form from the Insert menu.

    An empty form is created on the page. You may have to enable Invisible Elements (View > Visual Aids > Invisible Elements) to see the form’s boundaries, which are represented by thin red lines.

  3. Name the HTML form by clicking the <form> tag at the bottom of the Document window to select the form, opening the Property inspector (Window > Properties), and entering a name in the Form Name box.

    You don’t have to specify an action or method attribute for the form to tell it where and how to send the record data when the user clicks the Submit button. The Insert Record server behavior sets these attributes for you.

  4. Add text fields (Insert > Form > Text Field) to let the user enter a user name and password.

    The form can also have more form objects to record other personal data.

    You should add labels (either as text or images) beside each form object to tell users what they are. You should also line up the form objects by placing them inside an HTML table. For more information on form objects, see Creating web forms.

  5. Add a Submit button to the form (Insert > Form > Button).

    You can change the label of the Submit button by selecting the button, opening the Property inspector (Window > Properties), and entering a new value in the Value box.

    The next step in creating a registration page is to add the Insert Record server behavior to insert records in the table of users in the database.

Update the database table of users

You must add an Insert Record server behavior to the registration page to update the table of users in the database.

  1. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select Insert Record from the pop‑up menu.

    The Insert Record dialog box appears.

  2. Complete the dialog box, making sure to specify the table of users in the database into which the user data will be inserted. Click OK.

    The final step in creating a registration page is to make sure the user name is not used by another registered user.

Add a server behavior to ensure a unique user name

You can add a server behavior to a user registration page that verifies that the user name is unique before adding that user to your database of registered users.

When the user clicks the Submit button on the registration page, the server behavior compares the user name entered by the user against the user names stored in a database table of registered users. If no matching user name is found in the database table, the server behavior carries out the insert record operation normally. If a matching user name is found, the server behavior cancels the insert record operation and opens a new page (usually a page alerting the user that the user name is already taken).

  1. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select User Authentication > Check New Username from the pop‑up menu.
  2. In the Username Field pop‑up menu, select the form text field that your visitors use to enter a user name.
  3. In the If Already Exists, Go To box, specify a page to open if a matching user name is found in the database table, and click OK.

    The opened page should alert the user that the user name is already taken and let the user try again.