Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Step 7. Allowing Record Ownership

Step 7. Allowing Record Ownership

The last thing you need to do on the Search page is create a login area at the bottom. This is where users can enter their last name and password in order to get to the Edit page. Here they can update the information that you will have bound to fields on that page. Their changes will dynamically update the database.

On the Edit page (edit.html), the process is straightforward:

  1. Create a form that displays the text fields you want users to update, label the text fields accordingly.
  2. Bind the form fields to their corresponding database fields using the Dynamic Bindings palette.
  3. Copy and paste the Search_Results Content Source from the Search page to the head section of the Edit page
  4. Rename the Edit page Content Source to Matched_Record
  5. Set the lname field to “Match request parameter ‘lname'” in the Filter Records section of the Inspector
  6. Set the password field to “Match request parameter ‘password'” in the Filter Records section of the Inspector
  7. Add a Submit Action button from the Dynamic Content palette
  8. Make sure the Action is set to Update Record in the Dynamic Bindings palette
  9. Set the Content Source to Matched_Record

Tip: At this point you could also create a generic success and failure page that says something like “Action Successful” and “Operation Failed!” You could then set the “On success redirect to:” and “On failure redirect to:” options in the Dynamic Bindings palette to link to the appropriate pages.

So now you’ve created a Content Source that only returns records that match the Last Name and Password exactly. Guess what? That means only one record will be returned, and only if the user typed in the exact last name and matching password. You’ve just implemented a simple form of Record Ownership!

What if someone enters an incorrect name and password? Just set up your Edit page to “Hide Content” if no matching record is found, as follows:

  1. Drag and drop a Hide Content object from the Dynamic Content palette onto the Edit page
  2. Cut and paste your edit form into the Hide Content area next to the word “Content” (you can then delete the word ‘Content’)
  3. Select the Hide Content object
  4. Click Show/Hide in the Dynamic Bindings palette and select Hide
  5. Choose “If no records” from the pop up menu
  6. Select Matched_Record as the Content Source

What you’ve done is say: “please hide this form only if there was no match; i.e. the user typed in an incorrect name and password.”

And, as we don’t want them to get a blank page if their login fails:

  1. Drag and drop a Hide Content object from the Dynamic Content palette onto the Edit page
  2. Cut and paste your login form from the Search page into the Hide Content area next to the word “Content” (you can then delete the word ‘Content’)
  3. Type “Try Again!” above the login form
  4. Select the Hide Content object
  5. Click Show/Hide in the Dynamic Bindings palette and select Show
  6. Choose “If no records” from the pop up menu
  7. Select Matched_Record as the Content Source

This last step enables the user to try again.

I also use this technique on the Search page to show and hide content in case there is a search that returns no records. The sample Search page will show you how it’s done.

This tutorial shows enough for you to figure out the other features implemented in the sample files. If you look through those you can see examples of:

  • Deleting a Record
  • Confirming a record deletion
  • Adding a Record by generating a blank form
  • Adding a Master Admin page for Admin editing of ALL records
Putting It All Together

Today’s Web publishing tools make it possible for relatively non-technical designers to build and deploy database-driven Websites. As demonstrated above, Adobe GoLive palettes and wizards can give your site a significant leap in functionality and effectiveness without much programming expertise.

As you experiment with a basic level of dynamic data, you will quickly begin to devise ways to make your sites more streamlined and efficient. From there, the sky’s the limit!

Thanks go to David Richards of WDTP for his assistance with this tutorial.

Comments