Create the students form

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:

  1. Open the form page in Dreamweaver. This page was created by the wizard applied in the index file.

  2. Start the Create NeXTensio Form Wizard from the MX Kollection tab of the Insert panel.

  3. 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:


     

  4. 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:


     

  5. In the third step of the wizard you can establish some validation rules for the NeXTensio form:


     

  6. In the fourth and last step of the wizard:


     

  7. 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.

  8. This wizard has only one step:


     

  9. 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.

  10. 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.
If you want the many to many checkboxes to display only a subset of the available courses, based on a condition, you have to alter the many-to-many recordset that is created:

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.