Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to preserve formatting when copying and pasting into a web form.

Status
Not open for further replies.

UnDoug

Programmer
Dec 11, 2002
14
US
Hi,

I'm having a problem with an HTML web form that is generated by a Perl script.

The Perl script first reads in an HTML file and displays it's contents at the top of the page (it's the syllabus for a course taught by a college instructor). Beneath the syllabus, is the web form. The instructor needs to be able to copy from the syllabus and paste into the form's blanks. This all works just fine, but when the instructor clicks submit and it displays what he or she has submitted so that they can make changes if necessary, the text that was pasted in loses its formatting (spacing, tabs, etc.).

I believe this is due to the fact that they are copying and pasting formatted text. When I copied one section of a syllabus web page and pasted it into a blank MS Word document, it displayed automatically as a Table with borders, even though there were no borders in the HTML page it came from.

An additional weird thing is that sometimes it seems to display okay--just the way it looked in the original, but other times it loses all formatting.

Is there anything I can do to guarantee that the spacing at least won't be lost when text is copied and pasted into my form?

Thanks!

Douglas
 
HTML does not recognize multiple spaces, nor does it recognize newlines. All space characters (including newlines) are made into a single space. To do a newline, use <br>. Alternatively, wrap <pre></pre> tags around your content to make it interpret spaces as you expect. Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top