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

Can I pass multiple values from a select box?

Status
Not open for further replies.

ljevans

Technical User
Apr 4, 2001
53
US
I have a select box that is populated using 2 queries, each from different tables. They both pass pkey for value. Based on which table's value is selected, determines another setting when an update takes place. I may have a pkey value of 8 for a department and a pkey value of 8 for an employee. I need to know which table the pkey value came from. Any thoughts?

Code:

<!---
<select name="assignment">
<cfoutput query="dept">
<option value="#pkey#">#dept#</option>
</cfoutput>
<cfoutput query="emp">
<option value="#pkey#>#employee#</option>
</cfoutput>
</select>
--->
 
Code:
<select name="assignment">
   <cfoutput query="dept">
       <option value="[red]dept_[/red]#pkey#">#dept#</option>
   </cfoutput>
   <cfoutput query="emp">
        <option value="[red]emp_[/red]#pkey#>#employee#</option>
   </cfoutput>
</select>
Your results will look like "dept_8" or "emp_8". On your action page check for "dept_" or "emp_" in your form values, this will tell you which table it came from.
Code:
<cfif ListFirst(Form.assignment,'_') EQ "dept">
   This is from the DEPT Table
<cfelseif ListFirst(Form.assignment,'_') EQ "emp">   
   This is from the EMP Table
</cfif>

Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top