0

/t5/coldfusion-discussions/passing-form-variables/td-p/557469
May 08, 2007
May 08, 2007
Copy link to clipboard
Copied
HI~
I have a cfform on my index.cfm page, and the action is set to go to a confirm.cfm page. On that page, I want the user to be able to look at the information they entered into the form, and then hit "Submit" if it is correct. Right now, I am able to display the form information on the confirm.cfm page, but I'm having a hard time with my insert statement. Right now, when I hit the final Submit button, an entry is made in the database, but none of the variables are passed. I'm guessing this is because of the cfparam default="" setting, but I don't know what else to set it as-- if I try to set it as semester or form.semester, it says it is not defined. Please help! Thanks!
I have a cfform on my index.cfm page, and the action is set to go to a confirm.cfm page. On that page, I want the user to be able to look at the information they entered into the form, and then hit "Submit" if it is correct. Right now, I am able to display the form information on the confirm.cfm page, but I'm having a hard time with my insert statement. Right now, when I hit the final Submit button, an entry is made in the database, but none of the variables are passed. I'm guessing this is because of the cfparam default="" setting, but I don't know what else to set it as-- if I try to set it as semester or form.semester, it says it is not defined. Please help! Thanks!
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Mentor
,
May 09, 2007
May 09, 2007
You need to make sure that the form.semester variable is
treated as a variable... use #'s and <cfoutput> tags....
<cfform action="#CGI.SCRIPT_NAME#" name="submitEval" METHOD="post">
<!--- Submit Button that reads "Submit Evaluation" --->
<cfinput type="submit" value="Submit Evaluation" name="submitEval" id="submitEval">
<cfoutput>
<cfinput type="hidden" name="semester" value="#form.semester#">
</cfoutput>
</cfform>
Phil
<cfform action="#CGI.SCRIPT_NAME#" name="submitEval" METHOD="post">
<!--- Submit Button that reads "Submit Evaluation" --->
<cfinput type="submit" value="Submit Evaluation" name="submitEval" id="submitEval">
<cfoutput>
<cfinput type="hidden" name="semester" value="#form.semester#">
</cfoutput>
</cfform>
Phil

Guest
AUTHOR
/t5/coldfusion-discussions/passing-form-variables/m-p/557470#M51226
May 08, 2007
May 08, 2007
Copy link to clipboard
Copied
On the second form, you should add a hidden form field to
pass the previous Form variable along.
<cfinput type="hidden" name="semester" value="Form.semester">
So, when you submit the second Form - it will have the value from the first Form. Otherwise, the variable Form.semester does not exist.
<cfinput type="hidden" name="semester" value="Form.semester">
So, when you submit the second Form - it will have the value from the first Form. Otherwise, the variable Form.semester does not exist.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/coldfusion-discussions/passing-form-variables/m-p/557471#M51227
May 08, 2007
May 08, 2007
Copy link to clipboard
Copied
Exactly.
It makes it clear if you simply display the form data for review:
<cfoutput>
#form.semester#
</cfoutput>
<cfinput type="hidden" name="semester" value="Form.semester">
Then direct the user back to edit or forward to confirm
It makes it clear if you simply display the form data for review:
<cfoutput>
#form.semester#
</cfoutput>
<cfinput type="hidden" name="semester" value="Form.semester">
Then direct the user back to edit or forward to confirm
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/passing-form-variables/m-p/557472#M51228
May 09, 2007
May 09, 2007
Copy link to clipboard
Copied
OK... so, do I just need the hidden field, or do I still need
the <cfparam> tag?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/passing-form-variables/m-p/557473#M51229
May 09, 2007
May 09, 2007
Copy link to clipboard
Copied
semi star gazer wrote:
> OK... so, do I just need the hidden field, or do I still need the <cfparam> tag?
you must have a form field (hidden or not) that stores selected/entered
semester from the first form (index page) in your second form (confirm
page), otherwise when that (second) form (is submitted, it does not hold
any reference to the semester inside its scope...
--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
> OK... so, do I just need the hidden field, or do I still need the <cfparam> tag?
you must have a form field (hidden or not) that stores selected/entered
semester from the first form (index page) in your second form (confirm
page), otherwise when that (second) form (is submitted, it does not hold
any reference to the semester inside its scope...
--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/passing-form-variables/m-p/557474#M51230
May 09, 2007
May 09, 2007
Copy link to clipboard
Copied
OK, I think I'm still missing something here. This is what I
have right now. With this code, I get a blank entry in the database
when the user hits the Submit button.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
/t5/coldfusion-discussions/passing-form-variables/m-p/557476#M51232
May 09, 2007
May 09, 2007
Copy link to clipboard
Copied
You need to make sure that the form.semester variable is
treated as a variable... use #'s and <cfoutput> tags....
<cfform action="#CGI.SCRIPT_NAME#" name="submitEval" METHOD="post">
<!--- Submit Button that reads "Submit Evaluation" --->
<cfinput type="submit" value="Submit Evaluation" name="submitEval" id="submitEval">
<cfoutput>
<cfinput type="hidden" name="semester" value="#form.semester#">
</cfoutput>
</cfform>
Phil
<cfform action="#CGI.SCRIPT_NAME#" name="submitEval" METHOD="post">
<!--- Submit Button that reads "Submit Evaluation" --->
<cfinput type="submit" value="Submit Evaluation" name="submitEval" id="submitEval">
<cfoutput>
<cfinput type="hidden" name="semester" value="#form.semester#">
</cfoutput>
</cfform>
Phil
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/passing-form-variables/m-p/557477#M51233
May 09, 2007
May 09, 2007
Copy link to clipboard
Copied
right on! just no need for <cfoutput> tags around it, #'s are enough...
how did i miss that??? should go to bed now...
anyway, that still does not explain why his form.semester is an empty
string, since, without the #'s, the value of the hidden field will be
literal 'form.semester', and that is what should be inserted into the
db, not an empty string.....
--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/passing-form-variables/m-p/557475#M51231
May 09, 2007
May 09, 2007
Copy link to clipboard
Copied
semi star gazer wrote:
> OK, I think I'm still missing something here. This is what I have right now.
> With this code, I get a blank entry in the database when the user hits the
> Submit button.
>
> <cfparam name="form.semester" default="">
>
> <cfif isDefined("form.submitEval")>
>
> <!--- insert form data into database --->
> <cfquery name="insertEval" datasource="intern">
> INSERT INTO mentorEvals (
> semester
> ) VALUES (
> '#Trim(form.semester)#'
> )
> </cfquery>
>
> <cfform action="#CGI.SCRIPT_NAME#" name="submitEval" METHOD="post">
> <cfinput type="hidden" name="semester" value="form.semester">
> <!--- Submit Button that reads "Submit Evaluation" --->
> <cfinput type="submit" value="Submit Evaluation" name="submitEval"
> id="submitEval">
> </cfform>
>
try using <input type="hidden" ...> instead of <cfinput ...> - i seem to
recall there being issues with hidden cfinput fields...
also - where's your closing </cfif>??? it should be after </cfquery> - i
hope it is actually there...
just to make sure semester is passed from first form, you can put
<cfoutput>#form.semester#</cfoutput> right after your <cfparam>
NOTE: you do not really need that <cfparam> there... it does not do
anything... unless you are planning to use it later for validation
routines... i wonder if it may be tampering with the semester value...
it shouldn't, but who knows...
--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
> OK, I think I'm still missing something here. This is what I have right now.
> With this code, I get a blank entry in the database when the user hits the
> Submit button.
>
> <cfparam name="form.semester" default="">
>
> <cfif isDefined("form.submitEval")>
>
> <!--- insert form data into database --->
> <cfquery name="insertEval" datasource="intern">
> INSERT INTO mentorEvals (
> semester
> ) VALUES (
> '#Trim(form.semester)#'
> )
> </cfquery>
>
> <cfform action="#CGI.SCRIPT_NAME#" name="submitEval" METHOD="post">
> <cfinput type="hidden" name="semester" value="form.semester">
> <!--- Submit Button that reads "Submit Evaluation" --->
> <cfinput type="submit" value="Submit Evaluation" name="submitEval"
> id="submitEval">
> </cfform>
>
try using <input type="hidden" ...> instead of <cfinput ...> - i seem to
recall there being issues with hidden cfinput fields...
also - where's your closing </cfif>??? it should be after </cfquery> - i
hope it is actually there...
just to make sure semester is passed from first form, you can put
<cfoutput>#form.semester#</cfoutput> right after your <cfparam>
NOTE: you do not really need that <cfparam> there... it does not do
anything... unless you are planning to use it later for validation
routines... i wonder if it may be tampering with the semester value...
it shouldn't, but who knows...
--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/passing-form-variables/m-p/557478#M51234
May 09, 2007
May 09, 2007
Copy link to clipboard
Copied
Thanks everyone!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

