Solved

cfselect cfinput can I bind the displayed text?

Posted on 2011-02-24
3
710 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
[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
  • 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 29

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 29

Expert Comment

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

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 …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

691 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