Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

populate textbox

Posted on 2011-09-10
10
Medium Priority
?
402 Views
Last Modified: 2012-05-12
Hi,

I want to populate my txtArea with list of states pulled from my database.

If I am using a dropdown box I would use option but for the txtarea how can I identify the value and the name of the textarea.

my code is wrong textarea shouldn't have option??

<textarea id="TxtAreaState" name="TxtAreaState" cols="20" rows="8">
<cfoutput query="DispState">
<option value="#DispState.StateID#">#DispState.StateName#</option>
</cfoutput>
 </textarea>
<CFQUERY DATASOURCE="xx" NAME="DispState" cachedwithin="#createTimeSpan(0,0,0,-1)#">
		SELECT distinct StateTbl.StateID, StateTbl.StateName
		FROM StateTbl
		LEFT JOIN CityTbl ON CityTbl.StateID = StateTbl.StateID
		LEFT JOIN ChurchTbl ON ChurchTbl.ChCityID = CityTbl.CityID
		WHERE ChurchTbl.ChurchName <> "null" and ChurchTbl.ChurchStatus = 1
		and CityTbl.CityStatus = 1 and StateTbl.StateStatus = 1
	</CFQUERY>

Open in new window

0
Comment
Question by:lulu50
[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
  • 6
  • 4
10 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 36516199
I would  do it this way.

<textarea id="TxtAreaState" name="TxtAreaState" cols="20" rows="8">
<cfoutput query="DispState">
#DispState.StateName# [#DispState.StateID#]<br>
</cfoutput>
 </textarea>
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 36516201
why do you nee d drop down? is that just an otput. what are you trying to do ?
0
 

Author Comment

by:lulu50
ID: 36516210
<textarea id="TxtAreaState" name="TxtAreaState" cols="20" rows="8">
<cfoutput query="DispState">
#DispState.StateName# [#DispState.StateID#]<br>
</cfoutput>
 </textarea>

I don't want to show the id

http://www.churchesbulletin.com/

when the user click on the state I have to populate the city
0
Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

 
LVL 19

Expert Comment

by:erikTsomik
ID: 36516215
then do this
<textarea id="TxtAreaState" name="TxtAreaState" cols="20" rows="8">
<cfoutput query="DispState">
#DispState.StateName#<br>
</cfoutput>
 </textarea>

But in order to do this I would recommend using this plugin

http://codeassembly.com/Simple-chained-combobox-plugin-for-jQuery/

0
 

Author Comment

by:lulu50
ID: 36516221
I am not sure why there is empty spaces
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 36516223
try this
<textarea id="TxtAreaState" name="TxtAreaState" cols="20" rows="8">
<cfoutput query="DispState">
#trim(DispState.StateName)#
</cfoutput>
 </textarea>
0
 

Author Comment

by:lulu50
ID: 36516225
erikTsomik

I don't have the <br> and I still have spaces
0
 
LVL 19

Accepted Solution

by:
erikTsomik earned 2000 total points
ID: 36516240
the space probably caused by textarea CSS.
0
 

Author Closing Comment

by:lulu50
ID: 36516250
Thank you
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 36516263
thank you
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

610 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