Solved

populate textbox

Posted on 2011-09-10
10
390 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ColdFusion MS SQL CSV Impport 10 66
Coldfusion subreport - passing parameters 2 67
coldfusion, jQuery help 25 95
Coldfusion - query to list question 3 36
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, 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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

776 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