Dreamweaver

Add a server behavior to ensure a unique user name (ColdFusion, ASP, JSP, PHP)

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.