textarea and textbox DOM API

[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 UTC