W3C home > Mailing lists > Public > www-forms-editor@w3.org > September 2003

textarea and textbox DOM API

From: Frank Boumphrey <boumphreyfr@agentbrand.com>
Date: Tue, 30 Sep 2003 16:30:24 -0400
Message-ID: <00e501c38791$ae3173b0$0300a8c0@D1C4FN01>
To: <www-forms-editor@w3.org>
[cross posted to www-html-editor.]

Looking at HTML forms (and Xforms) there is one glaring
omission, which is really in the ability for users to manipulate text in
text boxes using script.

I've always felt that one of the things missing from web
applications is the ability for users to be able to manipulate
text in a text box. 

For example you can't position a text cursor using
script; identify the position of the cursor;select a hunk of text using script;
insert text into a certain position in a text box; or identify the text
selected by a user.

This makes building true web applications difficult. What is need is a change to the DOM API for HTML  forms.
I would suggest the following.

posCursor(int)... would place the cursor before the character at int location, returns that location
selText(int,int)... would select the text begining at int1 and ending at int2, returns a string
insertText(int,string)...inserts string at int
cutText(int,int)... cuts text between int and int. returns a string

getPosCursor().. returns the position of the cursor
getSelText()... returns the selected text as a string
cutSelText().. Cuts selected text and returns it (equivelent to ctrl/x in windows)
getSelTextStart() ...returns the start position of selected text
getSelTextEnd() ...returns the end position of selected text
getSelTextLen() ...returns the length of selected text

such a dom for writable areas would allow the development of real Internet applications.

Frank 
Frank Boumphrey
(Latest Book co-authored 'XML.NET Developers Guide' from Syngress Press by
Sills, Boumphrey and Ortiz)
Received on Tuesday, 30 September 2003 16:35:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 10 June 2009 18:12:12 GMT