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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Box

Status
Not open for further replies.

crimmelcp

Programmer
Oct 13, 2004
31
US
I need to have a select box to do a lookup on a table and then fill in fields on a form from the look up table.

Charlie Crimmel


 
we'll help you with code problems, or the theory behind it, but we're not going to do it for you. what is your question?


If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside.
 
I am not sure how to start the code.
I need to see an example of how a select box could do a lookup selection on a table, and return the values of multiple fields of the selected record to form variables.

Example:
I have an employee who has a craft of 451.
The form would have a select box for craft that would lookup on the wage table. the user would select the craft 451 and it would return the craft description and billing rate.
The wage file would have
451
Electrician Foreman
45.00

This information would be filled into form variables
craft = '#craft#'
desc = '#desc#'
billrate = "billrate"
that would then update the employees record with a submit button.
 
try this

<cfquery name="Author" datasource="exercises">
SELECT * FROm Authors
</cfquery>



<script>
function ShowAuthor(obj)
{
<cfloop query="Author">
if(obj.value=="<cfoutput>#Au_ID#</cfoutput>")
<cfquery name="GetAuthor" datasource="exercises">
SELECT * FROm tbbooksauthor WHERE Au_ID=#Au_ID#
</cfquery>
{

i=1;
<cfoutput query="GetAuthor">
document.write("#title#<BR>");
i++;
</cfoutput>

}
</cfloop>
}

</script>

<form name="form1">
Author:<select name="Authors" onchange="ShowAuthor(this)">
<option value="Select">Select</option>
<cfoutput query="Author">
<option value="#Au_ID#">#Author#</option>
</cfoutput>
</select>



</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top