Solved

populate textbox

Posted on 2011-09-10
10
387 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
  • 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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 500 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
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 …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

9 Experts available now in Live!

Get 1:1 Help Now