[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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

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
Lee R Liddick Jr
Asked:
Lee R Liddick Jr
1 Solution
 
umbraeCommented:
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
 
umbraeCommented:
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
 
black0psCommented:
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
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
umbraeCommented:
black0ps, is it this.selectedIndex or this.options.selectedIndex?

Honestly not sure.
0
 
Lee R Liddick JrReporting AnalystAuthor Commented:
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
 
black0psCommented:
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
 
pinaldaveCommented:
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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now