In this tutorial topic you will create the page that contains the NeXTensio form. It will allow you manipulate the students, and also the courses they register to - in this regard, the Many-To-Many Wizard will be applied on the page.
To build the page, follow the steps below:
Open the form page in Dreamweaver. This page was created by the wizard applied in the index file.
Start the Create NeXTensio Form Wizard from the MX Kollection tab of the Insert panel.
In the first step of the wizard the correct settings are already made due to the user interface persistence (after applying the Create NeXTensio List Wizard). So leave it unchanged and click the Next button to continue configuring the wizard.
If for any reason you removed the user interface persistence, configure the dialog box as in the image below:
Leave the settings from the second step of the wizard unchanged, too. Once again, notice that due to the user interface persistence, the label for the email_std column is already set to the one established earlier. Click the Next button to continue configuring the wizard:
In the third step of the wizard you can establish some validation rules for the NeXTensio form:
Select the email_std column in the Form fields grid and set its Validation format to E-mail Address.
Click the Next button to move on to the last step of the wizard.
In the fourth and last step of the wizard:
The only setting to be changed is to select the No option in the Copy down value drop-down menu. This will make the form look less crowded and much clearer (no copy-down buttons will be displayed beside the course checkboxes generated later with the Many-To-Many Wizard).
The rest of the settings are already correctly configured.
Click Finish to apply the Create NeXTensio Form Wizard.
The form building is not finished though once this wizard is applied. To be able to easily register new students to courses or to edit the course preferences of the current students, apply the Many-To-Many Wizard from the MX Kollection tab of the Insert panel.
This wizard has only one step:
In the Master table drop-down menu select the table on which the NeXTensio list and form are based on: student_std.
In the Many-to-many table select the student_to_course_stc table that keeps all the relations between students and courses.
In the Key to master table and Key to detail table drop-down menus select the columns that store the references to the primary keys of the two related tables: idstd_stc, respectively idcrs_stc.
Select the course_crs table as the detail one since it will be used to associate one or more courses to a certain student.
For the detail table, the primary key is held in the id_crs column and the names of the courses (the labels) are held in the name_crs column.
Specify the Number of columns that the records from the detail table will be displayed in (as checkboxes). Let's say 3 (the default value) for this application.
Click Finish to apply the Many-To-Many Wizard.
A new field is added to the NeXTensio form (at the end) containing a repeat region of checkboxes (all the available courses). Change the label corresponding to this field to Courses.
At this point, the page in Dreamweaver should look like this:
Save the page and upload it to the server. If you want to preview it in the browser, press the F12 key and you will see the NeXTensio form used to insert new students, along with the courses they want to attend:
In the next topic you will see how to actually use the list and form built in order to manipulate students and their course preferences.
|
Chris
Palle
03-14-2006
|
Question: What if you wanted to limit the classes available to the students based on a classification? Say someone is an honors student and another is remedial and then there are regulars? Answer: Before altering what courses (or any
other many-to-many records you are using) are displayed as checkboxes, you must
first make sure that you can distinguish between the different types you want.
For your example you should have another field in the courses table storing for
which student type it is appropriate. Then you must pass to the page where a new
student is added (and which contains the many-to-many trigger applied) the
student type you want – through a GET, POST or other type of variable. Below I
will explain using a GET variable. 1.
In the Bindings tab, aside the
tNG_recordset, a new entry is created when you apply the many-to-many trigger.
It’s named like rstable_name. 2.
Double click the many-to-many
recordset to edit it. It will open the Recordset Advanced dialog
box. 3.
After the existing SQL query you
must add your filtering condition - WHERE column_name = variable_name - E.g. if
the courses table also has a field storing the student type (stdtype_crs) and
you pass the student type as the stud_type URL parameter, you have
to: a.
Add a new Variable with the name
student_type and the run-time value equal to
$_GET[‘stud_type’] b.
Add to the code: WHERE stdtype_crs =
student_type 4.
Apply the changes and test the page.
It should only display the correct records. |