0
pass input textbox value to another cfm file
New Here
,
/t5/coldfusion-discussions/pass-input-textbox-value-to-another-cfm-file/td-p/630373
Mar 13, 2007
Mar 13, 2007
Copy link to clipboard
Copied
How do I pass the value entered into a textbox in one cfm
form to another that will query a databse and display the results?
thanks
thanks
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/pass-input-textbox-value-to-another-cfm-file/m-p/630374#M59184
Mar 14, 2007
Mar 14, 2007
Copy link to clipboard
Copied
This may be a good place to start:
http://livedocs.adobe.com/coldfusion/7/htmldocs/00001330.htm
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/pass-input-textbox-value-to-another-cfm-file/m-p/630375#M59185
Mar 14, 2007
Mar 14, 2007
Copy link to clipboard
Copied
quote:
Originally posted by: dzambo4114
How do I pass the value entered into a textbox in one cfm form to another that will query a databse and display the results?
thanks
Submit the form.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
dzambo4114
AUTHOR
New Here
,
/t5/coldfusion-discussions/pass-input-textbox-value-to-another-cfm-file/m-p/630376#M59186
Mar 14, 2007
Mar 14, 2007
Copy link to clipboard
Copied
Here's what I have tried:
form page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<!--- <form method="post" name="lookup" action="cdm_player_detail.cfm?cdmid=7"> --->
<body onload="focus();lookup.playerid.focus()">
<form method="post" name="lookup" action="cdm_player_detail.cfm?#lookup.playerid#">
<input type="textbox" name="playerid"</>
<input type="submit" value="Search"</>
<input type="button" value="Clear"</>
</form>
</body>
</html>
query form
<cfparam name="URL.CDMID" default="1">
<cfquery name="GetPlayers" datasource="cdmbb">
select *
from tbl_Players
where CDMID = #URL.CDMID#
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<table border="1" wifth="90%" >
<tr>
<td>CDMID</td>
<td>Name</td>
<td>Team</td>
<td>Salary</td>
<td>Pos</td>
</tr>
<cfoutput query="GetPlayers">
<tr>
<td>#GetPlayers.CDMID#</td>
<td>#GetPlayers.Player#</td>
<td>#GetPlayers.Team#</td>
<td>#GetPlayers.Salary#</td>
<td>#GetPlayers.Pos#</td>
</tr>
</cfoutput>
</table>
<body>
</body>
</html>
returns the first record in the table, not the desired record.
new to CF, thanks for your help.
Doug
form page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<!--- <form method="post" name="lookup" action="cdm_player_detail.cfm?cdmid=7"> --->
<body onload="focus();lookup.playerid.focus()">
<form method="post" name="lookup" action="cdm_player_detail.cfm?#lookup.playerid#">
<input type="textbox" name="playerid"</>
<input type="submit" value="Search"</>
<input type="button" value="Clear"</>
</form>
</body>
</html>
query form
<cfparam name="URL.CDMID" default="1">
<cfquery name="GetPlayers" datasource="cdmbb">
select *
from tbl_Players
where CDMID = #URL.CDMID#
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<table border="1" wifth="90%" >
<tr>
<td>CDMID</td>
<td>Name</td>
<td>Team</td>
<td>Salary</td>
<td>Pos</td>
</tr>
<cfoutput query="GetPlayers">
<tr>
<td>#GetPlayers.CDMID#</td>
<td>#GetPlayers.Player#</td>
<td>#GetPlayers.Team#</td>
<td>#GetPlayers.Salary#</td>
<td>#GetPlayers.Pos#</td>
</tr>
</cfoutput>
</table>
<body>
</body>
</html>
returns the first record in the table, not the desired record.
new to CF, thanks for your help.
Doug
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
LATEST
/t5/coldfusion-discussions/pass-input-textbox-value-to-another-cfm-file/m-p/630378#M59188
Mar 23, 2007
Mar 23, 2007
Copy link to clipboard
Copied
quote:
<form method="post" name="lookup" action="cdm_player_detail.cfm?#lookup.playerid#">
Instead of this action that you have listed, why not try
action="cdm_player_detail.cfm?playerid=#FORM.playerid#"
and then in your query on cdm_player_detail.cfm page, use WHERE playerid = '#URL.playerid#'
That will query all results based on the playerid from the form on the previous page.
Of course, make sure to validate the page by making sure a URL.playerid exists. This should be taken care of on the form page.
Lastly, your query on the results page is using a WHERE CDMID = '#URL.CDMID#' but by your code, you have commented out your URL.CDMID and instead are using playerid. I'm not sure which you are wanting to use, but judging by your form, you want to use playerid since you are actually submitting that variable. So use my above suggestion.
quote:
Originally posted by: Dan Bracuk
You're problem is here:
<form method="post" name="lookup" action="cdm_player_detail.cfm?#lookup.playerid#">
Make the playerid a hidden form field. That way all your variables on the action page will be in the form scope.
Since his form is submitting a playerid, he doesn't need to make a hidden field for playerid so long as he redirects his URL to FORM.playerid ... atleast that's my thinking on things unless i'm not seeing something right.
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/pass-input-textbox-value-to-another-cfm-file/m-p/630377#M59187
Mar 14, 2007
Mar 14, 2007
Copy link to clipboard
Copied
You're problem is here:
<form method="post" name="lookup" action="cdm_player_detail.cfm?#lookup.playerid#">
Make the playerid a hidden form field. That way all your variables on the action page will be in the form scope.
<form method="post" name="lookup" action="cdm_player_detail.cfm?#lookup.playerid#">
Make the playerid a hidden form field. That way all your variables on the action page will be in the form scope.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

