Binding a cfinput type=text with a cfselect multiple=true

I am trying to update the value of a cfinput with the items selected in a cfselect multiple select box. Here is a code snippet of the cfinput and cfselect tags:

<cfinput
	type="text" 
name="keywords" 
	bind="{keyword.value}"
	length="25" 
	onFocus="javascript:if(CFForm_1.hidden_keywords.value==''){this.value=''}"
	onBlur="javascript:CFForm_1.hidden_keywords.value=this.value; " 
    	tootip="Associate keywords with this resource." >
</cfinput>
<cfinput name="hidden_keywords" type="hidden" value="">
						
<cfset THIS.dsn="OPA_REPRO">

<cfquery datasource="#THIS.dsn#" name="get_keyword_list">
							SELECT keywrd_id, keywrd
	FROM repro_keywrd
	ORDER BY keywrd
</cfquery>
<cfselect 
	query="get_keyword_list"
	value="keywrd_id"
	id="keyword"
	display="keywrd"
	name="keyword" 
	title="Keyword" 
	required="false"
	multiple="yes"
	size="25">
</cfselect>

Open in new window


I keep getting the following message:

Bind failed, element not found: keyword

What am I not seeing? Isn't this a correct bind expression? I thought this would be simple. But, six hours later I still can't figure out what is causing the bind to fail. Help! CF8 by the way.
jfendleyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_agx_Commented:
As stupid as this sounds, try putting the text box after the select list.
jfendleyAuthor Commented:
Tried that, and on your request tried again. But, that doesn't resolve the issue. Bind still fails regardless of whether the CFINPUT is before or after the CFSELECT. I really thought this simple bind would work. But, it's really mucked up.
_agx_Commented:
Weird ... I got the same error as you w/CF9.  Then moved the elements.  Now I just tried it again, with the original code, and it works fine.   Odd ...
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

_agx_Commented:
Ooops .. posts clashed.

There's nothing wrong with your code from what I can see.  IMO it should work as is.  

Let me try restarting and see if I can get back that original error.
jfendleyAuthor Commented:
I just want the CFINPUT to be populated with the values selected in the CFSELECT.

I'd like the CFSELECT to be in a CFWINDOW. But, if this simple bind wont work, I'm not sure I want to try binding the CFINPUT to a CFSELECT in a CFWINDOW.
_agx_Commented:
Our posts keep clashing....

I understand.  But what I'm saying is there isn't any reason your code shouldn't work. You could re-write it with a bind="javascript:functionName(...)". If you want to explore that option let me know. But you're right to think what you have should work "as is".

jfendleyAuthor Commented:
That's disheartining. If it should work as is but doesn't, that means I have to program a work around for a feature that should work. Arrrgh.

Wouldn't happen to have a sample of code for that bind="javascript:functionName(..)" for this functionality would ya?

I was hoping to just have to add a @change to the bind to get the CFINPUT to update everytime a value in the CFSELECT was selected/deselected.
_agx_Commented:
Well javascript errors happen occasionally.  With all the sites out there using jquery I see it all the time. Anyway ..

A) Are you sure you're getting this error every time  and aren't just looking at a cached page? Also what browser?
B) Is that the exact code you're using?

Because I re-tried it under CF9 and CF8 and both are working fine.  I can't reproduce the error even after restarting.

<cfset get_keyword_list = queryNew("")>
<cfset queryAddColumn(get_keyword_list, "keywrd_id", listToArray("1,2,3"))>
<cfset queryAddColumn(get_keyword_list, "keywrd", listToArray("A,B,C"))>


<cfform>
<cfinput
	type="text" 
        name="keywords" 
	bind="{keyword.value}">
						
<cfselect 
	query="get_keyword_list"
	value="keywrd_id"
	id="keyword"
	display="keywrd"
	name="keyword" 
	title="Keyword" 
	required="false"
	multiple="yes"
	size="5">
</cfselect>
</cfform>

Open in new window


jfendleyAuthor Commented:
Interesting and wierd. Your code works when I insert it into the current page.

However, the existing code is between <cfform></cfform> tags. Your code was placed into the code with it's cfform tags intact and the bind works. But, when I remove your cfform tags to allow the code to flow within my existing cfform tags I get the bind error again.

Thoughts?
_agx_Commented:
Can you post the entire code you're using? Maybe there's something else in the form causing problems.
_agx_Commented:
> Your code was placed into the code with it's cfform tags intact and the bind works.

Well obviously it was intended to be a stand alone example ;)  I'm kindof surprised that even worked .. since nesting <form> tags isn't legal html.
jfendleyAuthor Commented:
I belive this is resolved. Moved cfform tags inside table tags and seems to be working properly now.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
_agx_Commented:
Lol,  since there were no <table>'s in the code posted, I wouldn't have come up with that one. For next time, be sure to post the actual code causing the problem.  It'll help cut to the chase quicker ;-)

Glad you solved it.  You should post a small example the bad vs fixed nesting and accept your comment as the answer.
jfendleyAuthor Commented:
I accepted my on comment as the solution because that's what worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.