473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Textarea and tabs

Hi all,
Thank you in advance. Here is the issue: I need to create a page that
allows users to copy the contents of a MS Word document and paste them
into a textarea. All fine and dandy...but the tabs. I don't need to
keep the formatting, just the tabs. Is there any way to detect the tabs
and change them to four spaces or something similar? If you have any
other ideas please let me know.

Thanks again for your help,
Kent

The email address is valid and I do check it.

Oct 12 '05 #1
3 2464

Kent wrote:
Hi all,
Thank you in advance. Here is the issue: I need to create a page that
allows users to copy the contents of a MS Word document and paste them
into a textarea. All fine and dandy...but the tabs. I don't need to
keep the formatting, just the tabs. Is there any way to detect the tabs
and change them to four spaces or something similar? If you have any
other ideas please let me know.


what happens to this stuff when then user submits? goes to a php
script? then what?

you might try to use http://www.fckeditor.net/ as it does have a 'paste
word' thing that might be able to keep the tabs.

--
j

Oct 12 '05 #2
Kent wrote:
Hi all,
Thank you in advance. Here is the issue: I need to create a page that
allows users to copy the contents of a MS Word document and paste them
into a textarea. All fine and dandy...but the tabs. I don't need to
keep the formatting, just the tabs. Is there any way to detect the tabs
and change them to four spaces or something similar? If you have any
other ideas please let me know.

Thanks again for your help,
Kent

The email address is valid and I do check it.


Tabs are retained in the textarea when the text is pasted. encodeURI
(or 'escape' for old browsers) will replace tabs with %09 - but that
will happen anyway when the form is submitted.

<textarea onchange="alert(encodeURI(this.value))"></textarea>

decodeURI/unescape (or equivalent on your server) will restore the tabs.

--
Rob
Oct 13 '05 #3
Kent wrote:
Here is the issue: I need to create a page that
allows users to copy the contents of a MS Word
document and paste them into a textarea. All
fine and dandy...but the tabs. I don't need to
keep the formatting, just the tabs. Is there any
way to detect the tabs and change them to four
spaces or something similar?


This will replace tabs by 4 spaces before submitting:

<html>
<body>
<form onsubmit="
document.forms[0].i.value =
document.forms[0].i.value.replace(/\t/g,' ');
// alert(document.forms[0].i.value);
return true;"
action="script.php">

<textarea name="i" rows="20" cols="60">
[paste content from WORD here]
</textarea>
<input type="submit">
</form>
</body>
</html>

--
Bart

Oct 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matt | last post by:
Simple vbscript,html page loading into access. Input pg posting to Confirm pg, then sending to access. when using; <textarea name="name" tabindex="15"> </textarea> as an input renders tab...
4
by: J. VerSchave | last post by:
I am curious if there is a way to handle this... maybe with Javascript... Is there a way to set a TEXTAREA field so that the tab key on the user's keyboard will create a tab within the text...
4
by: Jos van Uden | last post by:
Hello, Recently I created a validation script for a form that checks a textarea. The visitor is invited to send a list of 25 words, with each word on a new line. Before I submit the list I...
3
by: soup_or_power | last post by:
Hi My string contains "\t" for tabs. When the string is seen in a texarea I only see "t" without the escape. This is not what I expect. I expect either a blank or escaped-t. Any help is...
1
by: martin.igle+ASP | last post by:
the question is simple... is there any way to indent HTML code inside a simple textarea?... tnx! martin
5
by: bwucke | last post by:
Is there any way to scroll textarea (to the bottom row) from Javascript in Opera? The textarea.scrollTop=textarea.scrollHeight+textarea.scrollTop; approach doesn't work, and there's so many...
3
by: Rene Grothmann | last post by:
I try to send a bunch of lines from JavaScript to a Java applet on the same page. However, I receive only an empty string, unless the TextArea has only one line. Can someone put my nose on the...
14
by: EnjoyNews | last post by:
Hi I have a little probelm. I tranfer som data from input fields to a div so you can see how a profil will look as you type in your data. I just put this in my input field:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.