Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Looping thru' a form.

0 views
Skip to first unread message

Dark Knight

unread,
Apr 19, 2004, 1:49:04 PM4/19/04
to
Hi,
I am developing a form where in, I am listing 84 Denial Reasons with each
Denial Reason having 12 columns of text input boxes to fill into. Now I can
loop through the database table to list those 84 denial reasons, but is there
any way, When reading the form values, I can do some sort of looping to read
each of those 84 denial reasons along with their 12 text boxes values and enter
that data into the database. Please advise.

Thanks,
Dark Knight.

timster121

unread,
Apr 19, 2004, 2:14:33 PM4/19/04
to
There are several ways you can do it. One way is to loop thorough the
form.fieldnames variable, another is to loop through the form structure. It
really depends on how your form is setup. Do you have any code you can post?

Dark Knight

unread,
Apr 19, 2004, 4:35:54 PM4/19/04
to
Hi,
Sorry about the late response. I was caught up in some other stuff. Anyway, I
still have not coded anything on paper. But I was visualizing something like
this:

84 denial reasons listed in row format which gets populated from the database
table of Denial reasons.
Each Denial Reason row will have 12 text input boxes.

I can get the above stuff done. Now the problem is how will I read the data
in these 84 X 12 form elements and enter that data back into a separate table
in the database? Manually, we can do it but I was wondering if there could a
more efficient way to do it.

Thanks,
Dark Knight.

blewis

unread,
Apr 19, 2004, 4:50:28 PM4/19/04
to
No need to do it manually, that would be a bit taxing.

Is there a code or ID associated with each code? I would highly recommend
naming each of the 84 sets based on that code. So if you have code 123, then
you have twelve boxes names based on that (e.g. 123_1, 123_2, etc.)

Then on the processing page, you can parse the form.fieldnames variable. But
this can cause problems if there are other fields in the form which don't
follow the pattern. I usually just rerun the query I used to create the
original list on the form to re-get the list of IDs. Then loop over them and
use Evaluate() to get the values of the form fields.

Hope this makes a little sense...

Processing page:

<cfquery name="myIDs"...></cfquery>

<cfloop query="myIDs">
<cfquery>
UPDATE myTable
SET Reason1 = '#Evaluate("form." & myIDs.ID & "1")#'
WHERE myID = #myIDs.ID#
</cfquery>
</cfloop>

Lixulan

unread,
Apr 19, 2004, 5:43:50 PM4/19/04
to
does every field of the 84 possibilites have to be answered, or is it just one
row?

if its just one row use a relational database and a single group of 12 input
boxes.

make one table with the 84 denial reasons, and one table that stores the
responces.

thus you only have to work with 12 boxes at one time which is much easier for
both the developer and the user.


Dark Knight

unread,
Apr 20, 2004, 8:59:52 AM4/20/04
to
Hi,
Actually every field of the 84 denial reason's 12 rows has to be answered. Not
that they will, but I have to assume that they have the need for it. It is for
a medical application and assuming each of these denial reasons will need the
12 rows sometimes sooner or later, it is a safe bet.

Thanks,
Dark Knight.

Dark Knight

unread,
Apr 20, 2004, 11:54:32 AM4/20/04
to
Hi,
This idea I think will suit me best. But I had some doubt. Now this form has
other multiple form elements too but not really associated with this denial
reasons section. When I will be entering a new user data into the database,
will it create any conflict with the insertion of the data? I was apprehensive
because the form is really very huge.

Thanks once again,
Dark Knight.

Dark Knight

unread,
Apr 20, 2004, 11:54:33 AM4/20/04
to

Dark Knight

unread,
Apr 20, 2004, 11:54:33 AM4/20/04
to

Dark Knight

unread,
Apr 20, 2004, 11:54:59 AM4/20/04
to
0 new messages