• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

populate textbox

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
lulu50
Asked:
lulu50
  • 6
  • 4
1 Solution
 
erikTsomikSystem Architect, CF programmer Commented:
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
 
erikTsomikSystem Architect, CF programmer Commented:
why do you nee d drop down? is that just an otput. what are you trying to do ?
0
 
lulu50Author Commented:
<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
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
erikTsomikSystem Architect, CF programmer Commented:
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
 
lulu50Author Commented:
I am not sure why there is empty spaces
0
 
erikTsomikSystem Architect, CF programmer Commented:
try this
<textarea id="TxtAreaState" name="TxtAreaState" cols="20" rows="8">
<cfoutput query="DispState">
#trim(DispState.StateName)#
</cfoutput>
 </textarea>
0
 
lulu50Author Commented:
erikTsomik

I don't have the <br> and I still have spaces
0
 
erikTsomikSystem Architect, CF programmer Commented:
the space probably caused by textarea CSS.
0
 
lulu50Author Commented:
Thank you
0
 
erikTsomikSystem Architect, CF programmer Commented:
thank you
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now