Solved

TextArea to bullet points

Posted on 2001-06-11
8
1,412 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
  • 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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

947 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

20 Experts available now in Live!

Get 1:1 Help Now