Solved

TextArea to bullet points

Posted on 2001-06-11
8
1,501 Views
Last Modified: 2013-12-24
Hi folks this one is proving to be a stumper for me. I have a single text area where people can enter text.

I want to output the textarea as a unordered bullet list with a new bullet point created every time the user hits the enter key in the text area.

so if they typed

product one [enter]
Product two [enter]
product three [enter]

there would be a list with there points.

Not quite sure how to do this. I tried some code using the paragraph formate function but could not get it to work.

Any help would be greatly appreciated
0
Comment
Question by:mediatimebomb
[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
  • 4
  • 4
8 Comments
 
LVL 11

Expert Comment

by:jimmy282
ID: 6180075
simple...

<cfoutput>
#ReReplaceNoCase("#your_text_string#","#chr(10)##chr(13)#","<li>","ALL")#
</cfoutput>

Jimmy
0
 

Author Comment

by:mediatimebomb
ID: 6180119
Hi jimmy I tried your code and it does not seem to work

here is my code did I make a mistake?

form page

<html>
<body>

<form name="form1" method="post" action="formAction.cfm">
  <textarea name="textarea" cols="25" rows="5"></textarea>
  <br>
  <input type="submit" name="Submit" value="Submit">
</form>


</body>
</html>

action page

<html>
<body>

<ul>
 
<cfoutput>
#ReReplaceNoCase("#form.textArea#","#chr(10)##chr(13)#","<li>","ALL")#
</cfoutput>
 
 
</ul>


</body>
</html>

it just outputs the the text with a space in between

0
 
LVL 11

Expert Comment

by:jimmy282
ID: 6180127
try this

<cfoutput>
#ReReplaceNoCase("#form.textArea#","#chr(13)#","<li>","ALL")#
</cfoutput>
0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

Author Comment

by:mediatimebomb
ID: 6180152
Hi jimmy it's getting closer

the only problem is there is no bullet point in frount of the first entry and there is also an extra bullet point at the end.

I am fairly new to CF I tried this but it threw a big fat error

#ReReplaceNoCase("<li>","#form.textArea#","#chr(13)#","ALL","</li>")#

Thought it might help to put the <li> tag first and add an end </li> tag

Thanks
0
 
LVL 11

Expert Comment

by:jimmy282
ID: 6180175
actually what is happening is that this code converts all <enter>'s to <li>'s . so wherever u put a <enter>, it is converted to <li> . that is what ur question was.right?
0
 

Author Comment

by:mediatimebomb
ID: 6180200
Ya I guess it works if i manualy ad the first <li> tag before the code like this

<li>#ReReplaceNoCase("#form.textArea#","#chr(13)#","<li>","ALL")#

is it ok to not include a </li> closing tag after a list item. I see it doesn't throw an error in explorer but I wounder about other browsers?
0
 
LVL 11

Accepted Solution

by:
jimmy282 earned 65 total points
ID: 6180218
</li> is never required..dont worry

Jimmy
0
 

Author Comment

by:mediatimebomb
ID: 6180236
Thank you very much for your help.
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
What You Need to Know when Searching for a Webhost Provider
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 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