Solved

cfselect cfinput can I bind the displayed text?

Posted on 2011-02-24
3
704 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

837 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