Solved

Removing letters from microsoft office from textarea before submitting

Posted on 2006-06-26
2
160 Views
Last Modified: 2010-04-06
I have created a "wiki" based CMS system, where the users can submit the content using forms. This works OK, but sometimes the users copy-paste from word causing an error in the system due to encoding problems on the server. The submitted content is written to XML files.

I see the following options:
 - Replace all illegal letters using javascript before submitting the form
 - Displaying a warning if the user submitted an illegal letter

The solution can be created using javascript or serverbased using J2EE technology.

How do I detect these illegal letters?
How do I replace / remove these?

Regards

Morten
0
Comment
Question by:mortena
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 250 total points
ID: 16983322
Hi mortena,

It is a fairly common issue, you can use URLEncoding to deal with this. As you suggest replacing the characters in the textarea with permissable ones.

var ta=document.getElementById('MyTextArea')
ta.value = escape(ta.value)

In your OnSubmit() event. This will encode the string, which you can decode at the server using Server.URLDecode and store in your XML file. Or even store it undecoded and only decode when you need to send this back to a client. There is no harm in doing this for all your content whether or not it contains any illegal character. Except for a possible slight performance hit, though how big that might be is impossible to state with any accuracy at this point.

Tim Cottee
0
 

Author Comment

by:mortena
ID: 16999819
Well I found a solution, where I escape the content of whatever is in my forms on the page, replaces the escaped symbols with whatever is similar and legal and put's it right back into the input field in the form. See (and use if you need it):

http://www.blobcom.com/encodingControl.js

This can be included by inserting the following into the html:

 <script type="text/javascript" src="http://www.videntilvaekst.dk/extWiki/encodingControl.js"></script>

and for the form you need to "legalize" you have to put a:

onsubmit="legalizeForm()" attribute.

All I need now is a list of letters to translate and what they should be translated to. Please point me towards such a list.

Regards

Morten Andersen
Blob Communication

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to I "stripe" columns using XSLT 3 38
jquery validation by class 12 52
Create associate webpages / websites 3 67
Re-position the objects 7 97
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

920 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

17 Experts available now in Live!

Get 1:1 Help Now