Link to home
Start Free TrialLog in
Avatar of lulu50
lulu50Flag for United States of America

asked on

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

Avatar of erikTsomik
erikTsomik
Flag of United States of America image

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>
why do you nee d drop down? is that just an otput. what are you trying to do ?
Avatar of lulu50

ASKER

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

Avatar of lulu50

ASKER

I am not sure why there is empty spaces
try this
<textarea id="TxtAreaState" name="TxtAreaState" cols="20" rows="8">
<cfoutput query="DispState">
#trim(DispState.StateName)#
</cfoutput>
 </textarea>
Avatar of lulu50

ASKER

erikTsomik

I don't have the <br> and I still have spaces
ASKER CERTIFIED SOLUTION
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lulu50

ASKER

Thank you
thank you