473,700 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validating <textarea>

Hi. I hope someone here can help. I'm webmaster for a local astronomy
club. Just went over our web site. Have validated every htm file on the
site except:
http://validator.w3.org/check?uri=ht.../mas/COMET.htm

In the <textarea> of this page I have Javascript code. I can't figure out
how to present this code and still be w3c valid. Any advice would be
appreciated...D ennis
Jul 20 '05 #1
4 4323
"Dennis Allen" <de****@dennisa llen.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Hi. I hope someone here can help. I'm webmaster for a local astronomy
club. Just went over our web site. Have validated every htm file on the
site except:
http://validator.w3.org/check?uri=ht.../mas/COMET.htm

In the <textarea> of this page I have Javascript code. I can't figure out
how to present this code and still be w3c valid. Any advice would be
appreciated...D ennis


Do a search and replace on the code inside the textarea, and change all
opening angle brackets ("<") to "&lt;" and all closing angle brackets (">")
to "&gt;". The code will validate, and the text inside the textarea will
appear the same.

Christopher Finke
Jul 20 '05 #2
"Dennis Allen" <de****@dennisa llen.com> wrote:
Have validated every htm file on the
site except:
http://validator.w3.org/check?uri=ht...g.net/mas/COME
T.htm
That's not an "htm file" but a reference to a validator so that the URL
of a page is passed to it. Actually, not even that, since
"Within a query component, the characters ;, /, ?, :, @, &, =, +, ,,
and $ are reserved." (RFC 2396), so the reference is syntactically
malformed.
In the <textarea> of this page I have Javascript code. I can't
figure out how to present this code and still be w3c valid.


Why do you use a form input field when you don't want any user input?

Just put the Javascript code into a separate file and link to it, on a
page that explains what the code does, if you think the code is useful.
If the user's browser starts actually executing Javascript code when he
follows the link, then this will be a useful lesson, and a cheap one as
compared with the possibility of following an innocent-looking link
using a Javascript-enabled browser.

If you insist on embedding Javascript code as visible text onto your
HTML document, then make it really visible, inside <pre> element for
example, instead of forcing the user play with a separately scrollable
area inside a scrollable window.

In any case, any "<" and "&" as data characters in HTML should be
written as "&lt;" and "&amp;". (Using "&gt;" for ">" is never required
by HTML rules, but you might do it for symmetry, or to cope with some
assumed bugs in ancient browsers.) A rhetorical question: are you
qualified to make recommendations to other people about what they
should put into their HTML documents, if you were not able to figure
out this elementary HTML thing on your own?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #3
Just want I needed to know. Thanks...Dennis

"Christophe r Finke" <ch************ **@hotmail.com> wrote in message
news:bu******** ****@ID-158177.news.uni-berlin.de...
"Dennis Allen" <de****@dennisa llen.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Hi. I hope someone here can help. I'm webmaster for a local astronomy
club. Just went over our web site. Have validated every htm file on the site except:
http://validator.w3.org/check?uri=ht.../mas/COMET.htm
In the <textarea> of this page I have Javascript code. I can't figure out how to present this code and still be w3c valid. Any advice would be
appreciated...D ennis
Do a search and replace on the code inside the textarea, and change all
opening angle brackets ("<") to "&lt;" and all closing angle brackets

(">") to "&gt;". The code will validate, and the text inside the textarea will
appear the same.

Christopher Finke

Jul 20 '05 #4
That's what I need to know. Thanks...Dennis

"Jukka K. Korpela" <jk******@cs.tu t.fi> wrote in message
news:Xn******** *************** ******@193.229. 0.31...
In any case, any "<" and "&" as data characters in HTML should be
written as "&lt;" and "&amp;". (Using "&gt;" for ">" is never required
by HTML rules, but you might do it for symmetry, or to cope with some
assumed bugs in ancient browsers.) A rhetorical question: are you
qualified to make recommendations to other people about what they
should put into their HTML documents, if you were not able to figure
out this elementary HTML thing on your own?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #5

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

Similar topics

5
5155
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 spaces automatically.
1
4721
by: Augustus | last post by:
Hiya, I have a form with a <textarea></textarea> to receive user input. This input is then stored in a database and sent by fax... I need to be able to remove the carriage returns (enter key... vbcrlf...) from the input so that somebody doesn't do something like fill the textarea with 100s of keypresses of the enter key and end up spitting out tonnes of blank pages on the fax machine
2
9263
by: Jonathan Taub | last post by:
This may seem a stupid question. I've got a <textarea> element: .... <td> List of items: <textarea> 1. Apple 2. Orange 3. Box
16
2902
by: Martin Trautmann | last post by:
Hi all, I just had a problem where Mozilla 1.6 did not accept a XHTML 1.0 page that contained <p><textarea cols="50" name="prod_prob_description" rows="4" /></p> It did not accept the end tag />, but selected everything after til the EOF as text within the textarea.
11
13712
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom, there's an "Edit" link. So the page itself looks something like this: <HTML><HEAD><TITLE>blah</TITLE></HEAD><BODY> <!-- TEXT STARTS HERE --> <H1>Hello World!</H1> <P>More stuff here...</P>
3
6779
by: Jarek Mielcarek | last post by:
hi all, in xml file I have some fields which are source for <textarea> element. I'd like to transform this file using xslt and set the rows property of <textarea> depend of lines in some source field. How to do this? regards jaro
8
2263
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in each row needs a <textarea> control. The background supporting classes are completed, the only task left now is to create the web page. I am at a loss on how to create the table in the page populated by the data. Previously, I would have just...
6
31446
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at the HTML 4.01 specification I see this, too. What I'm wondering is - 'cols' & 'rows' determines the height & width of a textarea. So shouldn't that be something that is handled by CSS instead? What would be the practical consequence of leaving...
3
5660
by: FunkHouse9 | last post by:
I'm working on a form to collect data in a textarea which and am trying to keep returns and spaces. I have a couple of functions that I Frankensteined together to replace returns with <br> and to replace spaces with &nbsp;. The <br> part works well enough, but I keep getting "%20" instead of "&nbsp;" for the spaces. I understand that escape() changes " " to "%20", but I would think the ConvertSpaces function below would change the %20 to...
0
8731
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9218
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8929
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7816
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5904
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4408
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4660
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2031
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.