I have a SQlite database which receives data from a HTML form. If the enter key is pressed then it is of course inserted into the database.
On another page, the information from the database is placed inside a textarea. It all works fine, however when there is a line break, this does not work and the text is not inserted into the textarea.
I'm using the Python framework Flask to input the SQlite data into the javascript and then into the HTML.
What I have tried:
I've tried replacing the the line break with the text '\n' so that the line-break is then parsed by javascript. I tried this in python using regex like so:
Python:
def removeLineBreaks(text):
return re.sub(r'(\r\n|\n|\r)', "\\n", text)'
So the question is, how can a linebreak be placed into a HTML form (like any other character) by javascript from a SQLite database?
Aucun commentaire:
Enregistrer un commentaire