Solved

cfselect cfinput can I bind the displayed text?

Posted on 2011-02-24
3
700 Views
Last Modified: 2015-02-12
I need to bind not only the value of the cfselect to a cfinput (which works just fine) but also the displayed text from the cfselect.  I need to end up with the id from the cfselect in one cfinput and the associated name that is displayed in the cfselect as the value of the second cfinput.  The results of the second cfinput is "null" as it stands now.

My cfselect:---------------------------------------
<cfloop query="QContactTypes">
<cfoutput>
<td>#QContactTypes.description# Contacts:</td>
<td><cfselect bind="cfc:globalcfc.basic.getcontacts(compid={compGrid.id},specialty=#QContactTypes.acronym#)" name="#QContactTypes.acronym#" display="contactname" selected="contactname" value="id" bindonload="false" size="10"></cfselect>
</td>
</cfoutput>
</cfloop>


My cfinputs:-------------------------------------------------------------
<cfloop query="QContactTypes">
<tr>
<cfoutput>
<td align="right">#QContactTypes.description#:</td>
<td><cfinput type="text" name="#QContactTypes.acronym#ID" bind="{#QContactTypes.acronym#@change}" />
<cfinput type="text" name="#QContactTypes.acronym#name" bind="{#QContactTypes.acronym#.selectedItem}" /></td>
</cfoutput>
</tr>
</cfloop>
0
Comment
Question by:lantervj
  • 2
3 Comments
 

Accepted Solution

by:
lantervj earned 0 total points
ID: 34977464
I changed the cfinputs to bind on the .value and .text of the cfselect.  This worksjust fine.

<td><cfinput type="text" name="#QContactTypes.acronym#ID" bind="{#QContactTypes.acronym#.value}" />
<cfinput type="text" name="#QContactTypes.acronym#name" bind="{#QContactTypes.acronym#.text}" /></td>
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 40606371
<cfset qData = QueryNew ("value,display","varChar,varchar" )/>
<cfset t = QueryAddRow(qData)/>
<cfset t = QuerySetCell(qData,"value","no")>
<cfset t = QuerySetCell(qData,"display","No")>
<cfset t = QueryAddRow(qData)/>
<cfset t = QuerySetCell(qData,"value","yes")>
<cfset t = QuerySetCell(qData,"display","Yes")>

<cfset user_is_admin = "yes">

<cfform name="f1">
      <cfselect name="sel1" value="value" display="display" query="qData" selected="#user_is_admin#" queryPosition="below">
            <option value="">Select Option</option>
      </cfselect>
      <cfinput type="text" name="field1"  bind="{sel1.value}">
</cfform>
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 40606373
I did not realized you closed. Sorry
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

919 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now