Carl
With text fields, the field is passed regardless of if it has a value or
not.
So on your 2nd page, add this hidden field to your form
<input type="Hidden" name="QuestionCount" value="#Form.QuestionID#">
this will pass the number of questions to the next form.
Then on your 3rd page you would do something like this
<cfoutput>
<table>
<tr>
<td>Question</td>
<td>Answer</td>
</tr>
<cfloop from="1" to="#Form.QuesionCount#" index="i">
<tr>
<td>Question #i#</td>
<td>#Form["Question" & i]#</td>
</tr>
</cfloop>
</table>
</cfoutput>
I would just keep it as form fields unless the number of fields is going to
be bigger. If your going to use the sesion scope, set up a session
structure and use that as your questions scope
ie
<cfscript>
session.question = StructNew();
session.question.question1 = "bla"
</cfscript>
and so on
Hope this helps
Regards
Steve Onnis
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Carl
Vanderpal
Sent: Friday, 25 July 2003 1:58 AM
To: CFAussie Mailing List
Subject: [cfaussie] Form Probs...
Hello CFAussie,
I have a form which uses CFSWITCH (goes to next step)
Page 1 and 2 are cool as I pass the required amount of fields to the
second page but when I get to the 3rd page is where I am scratching
me head...as the loops are'nt being nice to me..!!
1) Page 1 Looks like this
<cfform action="video.cfm?action=1" name="addVideo" method="post">
<table>
<td>Company</td>
<td><select name="JobID" size="1">
<cfloop query="qGetJobNames">
<option value="#JobID#">#JobName#</option>
</cfloop>
</select>
</td>
<td>How Many Questions</td>
<td><select name="QuestionID">
<cfloop from="2" to="10" index="i">
<option value="#i#">#i#</option>
</cfloop>
</select></td>
</cfform>
Page 2 Looks like this
(Is the way below using best method, or is there a better way)
<cfform action="video.cfm?action=2" name="addVideo" method="post">
<cfloop from="1" to="#form.QuestionID#" index="i">
<tr>
<td>Question #i#</td>
<td><cfinput name="question#i#" type="text"></td>
</tr>
</cfloop>
</cfform>
Page 3 is where I am stuck??
How do I pump out the values of the form field "question" (if the user
passed say 3 questions) and loop through the results as
well as the other fields...
Result should be if the user passed 3 questions
Form Field q1 = #the passed value from the form#
Form Field q2 = #the passed value from the form#
Form Field q3 = #the passed value from the form#
ps. Is it better to set this as a SESSION Variable
(say "SESSION.Question") or is it better to pass the value in a hidden
field??
After that I will just loop to insert into a database
:-)
Thanks for your help...
Best regards,
Carl Vanderpal
Po Box 3462 Dural, NSW 2158
mailto:[EMAIL PROTECTED]
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/