Stefan Motz
asked on
Prevent html tags from being displayed in textarea
On my classic ASP page I have a textarea which is populated from an SQL Server table.
The content of the textarea shows the html tags like this: My text<br/>more text<br/>more <b>text</b>
Is there a simple solution that prevents the html tags from being displayed and the text appears formatted in the textarea instead?
The content of the textarea shows the html tags like this: My text<br/>more text<br/>more <b>text</b>
Is there a simple solution that prevents the html tags from being displayed and the text appears formatted in the textarea instead?
Is there a simple solution that prevents the html tags from being displayed and the text appears formatted in the textarea instead?yes, try use some HTML editor plugin, such as:
CKEditor
https://ckeditor.com/
TinyMCE
https://www.tiny.cloud/
ASKER
I tried contenteditable but unfortunately I'm not able to submit data from it. I need to update the text displayed in the textarea.
I'm also using text editors like RichText, Tinymce, NIcedit, but I can't customize them to my needs. My goal is to have an expandible textarea with rounded corners and shadowed borders. I can achieve that with contenteditable and also with a simple textarea, but both come with the problems I mentioned above.
I'm also using text editors like RichText, Tinymce, NIcedit, but I can't customize them to my needs. My goal is to have an expandible textarea with rounded corners and shadowed borders. I can achieve that with contenteditable and also with a simple textarea, but both come with the problems I mentioned above.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There are several things here.
First is how you are saving data to your database and how it is sent to your editor/page.
Next is selecting an editor and they all work similarly.
Last is skinning your editor. And that can typically be done and will depend on which editor you are using.
Are you saving html tags to your database? Or is your editor converting to urlencoded tags? In other words, does the comment get stored as
To help here, it would be best to focus on one editor that you want to use. Which are you using and how is the data stored?
First is how you are saving data to your database and how it is sent to your editor/page.
Next is selecting an editor and they all work similarly.
Last is skinning your editor. And that can typically be done and will depend on which editor you are using.
Are you saving html tags to your database? Or is your editor converting to urlencoded tags? In other words, does the comment get stored as
%3Cbr%2F%3Emore%20text%3Cbr%2F%3Emore%20%3Cb%3Etext%3C%2Fb%3E
or
<br/>more text<br/>more <b>text</b>
To help here, it would be best to focus on one editor that you want to use. Which are you using and how is the data stored?
ASKER
Thank you for your replies and I'm sorry for getting back late.
Scott, the data is stored as <br/>more text<br/>more <b>text</b>
I don't know how to convert it to urlencoded tags using classic asp. I guess I should post a different question on that topic.
Darren, I'm trying to submit using your suggestion. Thank you so much!
Scott, the data is stored as <br/>more text<br/>more <b>text</b>
I don't know how to convert it to urlencoded tags using classic asp. I guess I should post a different question on that topic.
Darren, I'm trying to submit using your suggestion. Thank you so much!
ASKER
Thank you Everyone. Now I can submit the form from the DIV. The reason it didn't work before was that I didn't give my DIV a name.
I think that you could use a content editable div instead. This will not be possible using the
Open in new window
Use something like
Open in new window
You can look this up and find plenty of references.
Hope this helps
Thanks,
Darren