automatically filling form fields based on user selection
Posted on 2004-03-28
I am relatively new to Cold Fusion and would appreciate some help in formulating code to do the following.
I am trying to create an action page that will allow users to select a "year" with a set of corresponding subjects and subject codes. The idea is that after the user has selected their year (#Year#) on one part of the form, they are presented with a drop-down list of subject names that apply only to that year. The subject names, codes and offered years are stored in an Oracle table with the fields "title", "subject" and "year" (respectively). I want it so that the user need only select the "title" and then subject name and code will automatically enter on-screen table that will accept up to 12 entries. The names of the table fields are "SubjectName1" through to "SubjectName12" and "SubjectCode1" through to "SubjectCode12". I only want the year to be saved into the earlier mentioned Year field.
Further to this, I would like to find a way in which I can restrict the number of entries into these "SubjectName" and "SubjectCode" fields. On another section of the field, there is an option where the user chooses the "duration". Code for this is
<table width=80%><div style="text-align: left;"><tr>
<th align=left width="200">Duration of Program</th>
<td> <input type="radio" name="Duration" value="One Semester">One Semester</input> </td>
<td> <input type="radio" name="Duration" value="Two Semesters">Two Semesters</input> </td>
It should be that if the "one semester " option is selected, the number of entries in subject names and codes is restricted to six (6); otherwise no restiction is imposed.
Help on the creation of this code is greatly appreciated.