Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem passing form values 1

Status
Not open for further replies.

brian1313

Programmer
Nov 1, 2001
29
US
Hey all,
I have a CF template with two "DISTINCT" SELECT statements. I'm using both of them to narrow down two database fields to only unique values. Then I'm using those two queries to populate one form to pass off the variables.
The problem I'm having is when i try to pass off the form inofrmation, the action page is dropping off an "Error resolving parameter" message saying that "The specified form field cannot be found." I assume that this is a pretty common error, but to the best of my knowledge, the form field name is correct. Code follows.

<!--- Begin form page --->

<html>
<head>
<title>test page</title
</head>
<body>

<cfquery name=&quot;events2&quot; datasource=&quot;ksuperc&quot;>
SELECT * FROM events2 ORDER BY event_year, event_semester
</cfquery>

<cfquery name=&quot;get_semester&quot; datasource=&quot;ksuperc&quot;>
SELECT DISTINCT event_semester FROM events2
</cfquery>

<cfquery name=&quot;get_year&quot; datasource=&quot;ksuperc&quot;>
SELECT DISTINCT event_year FROM events2
</cfquery>

<form action=&quot;display.cfm?event_year=#event_year#&event_semester=#event_semester#&quot; metohd=&quot;post&quot;>
<select name=&quot;semester&quot;>
<cfoutput query=&quot;get_semester&quot;>
<option value=&quot;#event_semester#&quot;>#event_semester#</option>
</cfoutput>
</select>
<select name=&quot;year&quot;>
<cfoutput query=&quot;get_year&quot;>
<option value=&quot;#event_year#&quot;>#event_year#</option>
</cfoutput>
</select>
<input type=&quot;submit&quot; value=&quot;search&quot;>
</form>

<!--- end form page --->

<!--- begin action page --->

<html>
<head>
<title>test page</title
</head>
<body>

<cfquery name=&quot;display&quot; datasource=&quot;ksuperc&quot;>
SELECT * FROM events WHERE event_semester='#form.semester#' AND event_year=#form.year#
</cfquery>

<cfoutput query=&quot;display&quot;>
<p>Name: #event_name#<br>
Date: #dateformat('#event_day#', &quot;mmmm d, yyyy&quot;)#
</cfoutput>

<!--- end action page --->

Thanks in advance for any help you folks can give me.

-b-
 
<form action=&quot;display.cfm?event_year=#event_year#&event_semester=#event_semester#&quot; metohd=&quot;post&quot;>

if it's really &quot;metohd&quot; then it isn't being sent as POST, it defaults to GET, and with GET the parameters are passed in the url

consequently, when the display.cfm page gets called, there are no form variables, only url variables

at least, that's what i'm guessing

also, the stuff you already have in the url query string will not be resolved by coldfusion, because it's not wrapped in cfoutput tags

change it to

<form action=&quot;display.cfm&quot; method=&quot;post&quot;>

and see if that works

rudy
 
That typo solved the first part of the problem. I had to make an action page with a redirect to the display page in order to carry the variables through. Once I did that though, no problems. Unfortunately, it's not the setup for the site that I'm going to end up using.
 
1st
I would pass those variables through hidden input forms, not in the action url.

2nd
I always use <cf_formurl2attributes> from all form and url variables are read as attributes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top