Solved

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

Posted on 2004-10-18
7
273 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 150 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

688 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