When the solution matters

Tips...

Registration Documentation Knowledgebase Seminars / Training Technical Support Partner Central

Room 4 Rent

Before you enter a Username and Password on the "Create an Account" page, it will be illuminating to first examine the WSC_CreateAccount method. This is the method that will process the HTML form when the user clicks "Continue." How do you know that? Because of this, from the create_account.shtml file:

<form name="create_account" action="/4DACTION/WSC_CreateAccount" method="post" >

screenshot

This is the heart of the WSC_CreateAccount method. Notice the variables WEBF_t_Username and WEBF_t_Password. These variables have the same names as the HTML form items on the create_account.shtml page:

<input type="text" name="WEBF_t_Username">
<input type="password" name="WEBF_t_Password">

As you may remember from previous tutorials, any 4D variable with the same name as an HTML form item will have the form item's value copied to the variable automatically, right after the Compiler_WEB method executes. This is covered in the documentation; scroll down to the heading "4DACTION to post forms" for more details.

Even if you are new to 4th Dimension, it should be pretty easy to discern what this method is all about. It begins by checking to see that the length of the Username and Password are acceptable. Then it checks to see if if there is already an [Applicants] record with the same Username, and if there is, it makes sure that ithas the same password as that which was supplied.

When an error is encountered, it is noted by a call to the WSC_ErrorMessage method. This method is really simple:

screenshot

All it does is build up the WEBF_t_ErrorMessage variable. It also returns the value of that variable in $0, so you can see what errors have been generated. The WEBF_t_ErrorMessage variable should be familiar to you - it is used in the "banner.html" file mentioned earlier. Of course, it's very easy to just reference the WEBF_t_ErrorMessage variable everywhere in the methods you write. But that isn't usually a good idea. Using a method such as WSC_ErrorMessage gives you more control. For instance, if at a later time you wished to add some extra functionality to your error messaging system, it would be easily to modify it right in the WSC_ErrorMessage method

If it is determined that a valid Username and Password have been submitted, some data is copied from the [Applicants] table to 4D variables (WEBF_t_NameFirst, etc.). These variables are used in the applicant_details.shtml page when it is sent out. If the Username is new and both it and the Password are valid, a new [Applicants] record is created.

Previous  1 2 3 4 5 6 7 8 9 10 11 12  Next Step


International | Company | Contact 4D | Site Map | Privacy Policy | © 4D UK 1995-2008 | Change font size: [A] [A] [A] | Print this page