Adding line breaks to a multi-line field using a custom format script
.Hi Everyone,
I'm creating a PDF that generates a report, but I'm stuck on how to automatically format the final text field, specifically to get line breaks before each bullet point.
This is how the report works - Depending on the answer given to a question, the PDF populates 2 fields; one with the positive elements and another with the ways to improve. All the positive answers are then gathered into a text field (reportPositiveFinal) using a simple JavaScript. When a 'Generate Report' button is hit, it triggers a JavaScript to transfer the positive text into the positive final report field (repP), as a string.
The problem - The text that comes out is fine, but there is no formatting. I want to have the text appear as a bulleted list; with a bullet beginning the line and a line break at the end of item.
Partial Solution - The closest I think I got to an answer was by using a custom format script using a regular expression to identify the bullet and replace it with a bullet with a line break before it, but I tried and failed to get it to work. (I'm still not entirely sure what a regular expression is!)
if (event.value!="• ")
event.value=event.value.replace(<br/>"• ")
My coding level is minimal, so I'm way out of my depth.
Is this the right idea? If not, what is the way to go?
Thanks!
