?
Solved

F/U to Qn /ColdFusion/#Q_21170271.html - pindaldave, umbrae, and blackops

Posted on 2004-10-18
7
Medium Priority
?
275 Views
Last Modified: 2013-12-24
This is a follow-up to question http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_21170271.html#12329284 .  

This is the form code with the query section.  When the user chooses the employee, I want the input "extension" to be automatically completed by taking that data from the query.

dbase field names in tbl_employees that are used: EmployeeID & SortName & Extension

<!-- BEGIN QUERY SECTION -->
<CFQUERY name="employees" datasource="mydns">
SELECT *
FROM tbl_employees
WHERE Active=1
ORDER BY SortName asc
</CFQUERY>
<!-- END QUERY SECTION -->

<!-- BEGIN Agent Trace Request Form -->
<CFFORM NAME="agttrace" ACTION="agt_trace-post.cfm" METHOD="POST">      
<table bgcolor="336699" width="95%" cellspacing="2" cellpadding="2" border="0">
<tr>
<td class="smallsilver" align="right" valign="middle">
Employee:<span class="smallred">*</span>
</td>
<td>
<SELECT name="EmployeeID">
<OPTION value="">
<CFOUTPUT query="Employees">
<OPTION value="#employeeid#">#SortName#
</CFOUTPUT>
</SELECT>
</td>
</tr>
<tr>
<td class="smallsilver" align="right" valign="middle">
CMS Agent ID:<span class="smallred">*</span>
</td>
<td>
<input type="text" name="extension" value="">
</td>
</tr>
<tr>
<td class="smallsilver" align="right" valign="middle">
Continuous Record:
</td>
<td class="small">
<input type="Radio" name="ContRec" value="Yes">Yes<BR>
<input type="Radio" name="ContRec" value="No" checked>No
</td>
</tr>
<tr>
<td class="tinysilver" align="left" valign="middle" colspan="2">
<font color="Red">*</font> = Required fields
</td>
</tr>
<tr>
<td align="center" valign="middle" colspan="2">
<input type="hidden" name="SubmitTime" value="<cfoutput>#CreateODBCDateTime(DateAdd("h",3, Now()))#</cfoutput>">
<input type="hidden" name="SubmittedBy" value="<cfoutput>#UserInitials#</cfoutput>">                                                
<INPUT type="Submit" value="Submit" class="smallblue">
<img src="../images/dot_clear.gif" height="2" width="15">                                          
<INPUT type="Reset" value="Clear Form" class="smallblue">
</td>
</tr>
</table>
</CFFORM>
<!-- END Agent Trace Request Form -->                  
0
Comment
Question by:Lee R Liddick Jr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 5

Expert Comment

by:umbrae
ID: 12338375
As black0ps' previous code suggested, something like this may be correct:

<td>
<SELECT name="EmployeeID" onChange="document.agttrace.extension.value = this.options[this.selectedIndex].value">
<OPTION value="">
<CFOUTPUT query="Employees">
<OPTION value="#employeeid#">#SortName#
</CFOUTPUT>
</SELECT>
</td>
0
 
LVL 5

Accepted Solution

by:
umbrae earned 600 total points
ID: 12338391
Whoops, thats incorrect.

Try this:

<td>
<SELECT name="EmployeeID" onChange="document.agttrace.extension.value = this.options[this.selectedIndex].value">
<OPTION value="">
<CFOUTPUT query="Employees">
<OPTION value="#extension#">#SortName#
</CFOUTPUT>
</SELECT>
</td>


The option value should be extension, not employeeID.

-Umbrae
0
 
LVL 7

Expert Comment

by:black0ps
ID: 12338661
Your code looks fine. Add the following to the opening of your select tag:

 onChange="document.agttrace.extension.value = this.options[this.options.selectedIndex].value;"
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 5

Expert Comment

by:umbrae
ID: 12338757
black0ps, is it this.selectedIndex or this.options.selectedIndex?

Honestly not sure.
0
 

Author Comment

by:Lee R Liddick Jr
ID: 12338831
Okay...I used the code that umbrae posted and it functions properly.  When I choose a name, the extension field is populated with the corresponding number to that agent.  Looks good.  Thank you!
0
 
LVL 7

Expert Comment

by:black0ps
ID: 12338994
umbrae, I think it's either one. I didn't check my code with your when I posted. I just copied and pasted without really looking.

-- Ian
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12338999
good to know it worked. I was out visiting my friends in LA and could not participate here.
Have a good day!
---Pinal
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question