Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-18
7
Medium Priority
?
280 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

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

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
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 reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

609 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