469,323 Members | 1,575 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

textarea problem

say i have a form where, if a user clicks in it, all the text is
highlighted, and where, if a user clicks on a button outside of the
form, a certain text string is inserted where the cursor in the
textarea is. why is it, then, that when i, immediatly after loading
the page, click in the textarea, highlighting the text, click again in
the middle of the text (effectively unhighlighting everything, as
well), and then click on the button to insert to the text, the text
string that is to be inserted appears outside of the form?

here's a working demonstration:

http://www.geocities.com/terra1024/error-forms.html

if you click right before the first and only capatilized T twice, and
then click on the ### link underneath the text area, ### is not
inserted into the form, as i would like, but is rather inserted
outside of the form.

if i comment out the function that is responsible for the
highlighting, it works just fine, although i can't see, for the life
of me, what in the highlighting function is causing this...

any help would be appreciated - thanks! :)
Jul 23 '05 #1
5 2410
On 14 Jun 2004 20:05:28 -0700, yawnmoth wrote:
http://www.geocities.com/terra1024/error-forms.html


You might check into this first..
<http://validator.w3.org/check?uri=http://www.geocities.com/terra1024/error-forms.html&charset=utf-8&doctype=HTML+4.01+Transitional>
Particularly errors 5 though 13, which
mention unmatched tags or similar..

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2
On Tue, 15 Jun 2004 07:44:07 GMT, Andrew Thompson
<Se********@www.invalid> wrote:
On 14 Jun 2004 20:05:28 -0700, yawnmoth wrote:
http://www.geocities.com/terra1024/error-forms.html


You might check into this first..
<http://validator.w3.org/check?uri=http://www.geocities.com/terra1024/error-forms.html&charset=utf-8&doctype=HTML+4.01+Transitional>
Particularly errors 5 though 13, which
mention unmatched tags or similar..


all errors after, and including, 5 deal with the geocities code
addition for ad placement, and as such, there's not really a whole lot
i can do about that :(
Jul 23 '05 #3
On Tue, 15 Jun 2004 17:09:03 GMT, yawnmoth wrote:
On Tue, 15 Jun 2004 07:44:07 GMT, Andrew Thompson wrote:
On 14 Jun 2004 20:05:28 -0700, yawnmoth wrote:
http://www.geocities.com/terra1024/error-forms.html
You might check into this first..
<http://validator.w3.org/check?uri=http://www.geocities.com/terra1024/error-forms.html&charset=utf-8&doctype=HTML+4.01+Transitional>

.... all errors after, and including, 5 deal with the geocities code
addition for ad placement,
Well, ain't that a mongrel. I just confirmed
what you said against a friends page that I'd
validated just before uploading to GeoCities.

Full of the same type of errors your page
is showing..

My apologies for any suggestion you had not
done all you might to solve the problem.

[ I have a documnet recommending folks put a
page up for applet/JS/HTML/CSS problems..
but the mangling by GeoCities does not help
much when debugging any of the above ]
...and as such, there's not really a whole lot
i can do about that :(


....hmmmm. I still wonder if that is a factor
though, the HTML becomes pretty mangled.
Perhaps one of the JS gurus who has more
experience with this situation might
clarify if it could be a factor.

Does it work as you expect on your home PC?

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #4
On Tue, 15 Jun 2004 19:10:08 GMT, Andrew Thompson
<Se********@www.invalid> wrote:
On Tue, 15 Jun 2004 17:09:03 GMT, yawnmoth wrote:
On Tue, 15 Jun 2004 07:44:07 GMT, Andrew Thompson wrote:
On 14 Jun 2004 20:05:28 -0700, yawnmoth wrote:

http://www.geocities.com/terra1024/error-forms.html

You might check into this first..
<http://validator.w3.org/check?uri=http://www.geocities.com/terra1024/error-forms.html&charset=utf-8&doctype=HTML+4.01+Transitional>

...
all errors after, and including, 5 deal with the geocities code
addition for ad placement,


Well, ain't that a mongrel. I just confirmed
what you said against a friends page that I'd
validated just before uploading to GeoCities.

Full of the same type of errors your page
is showing..

My apologies for any suggestion you had not
done all you might to solve the problem.

[ I have a documnet recommending folks put a
page up for applet/JS/HTML/CSS problems..
but the mangling by GeoCities does not help
much when debugging any of the above ]
...and as such, there's not really a whole lot
i can do about that :(


...hmmmm. I still wonder if that is a factor
though, the HTML becomes pretty mangled.
Perhaps one of the JS gurus who has more
experience with this situation might
clarify if it could be a factor.

Does it work as you expect on your home PC?


sadly, no :(

Jul 23 '05 #5
On 14 Jun 2004 20:05:28 -0700, te*******@yahoo.com (yawnmoth) wrote:
say i have a form where, if a user clicks in it, all the text is
highlighted, and where, if a user clicks on a button outside of the
form, a certain text string is inserted where the cursor in the
textarea is. why is it, then, that when i, immediatly after loading
the page, click in the textarea, highlighting the text, click again in
the middle of the text (effectively unhighlighting everything, as
well), and then click on the button to insert to the text, the text
string that is to be inserted appears outside of the form?

here's a working demonstration:

http://www.geocities.com/terra1024/error-forms.html

if you click right before the first and only capatilized T twice, and
then click on the ### link underneath the text area, ### is not
inserted into the form, as i would like, but is rather inserted
outside of the form.

if i comment out the function that is responsible for the
highlighting, it works just fine, although i can't see, for the life
of me, what in the highlighting function is causing this...

any help would be appreciated - thanks! :)


as a followup to this post, i've figured out a few things. the code
on the previously linked to html document was from phpBB. so, if you
highlight text in either, select within the highlighted text, and try
to insert some text (or a smiley in the case of phpBB), it'll be
instead inserted at the top of the page. so the problem isn't with my
use of a function to highlight text.

vBulletin (another message board software package) fixes this problem,
but in doing so, introduces another. when you click in a textarea,
and then click outside of it (without clicking on a link that would
insert something), and you then try to insert something, it'll be
inserted at the begining - not where the cursor previously was before
you selected outside of the textarea.

phpBB's approach has the so-called claret position being determined
via onClick, onKeyup triggers, whereas vBB determines it by
determining the current location when you immediatly try to insert
something.

in an attempt to get the best of both, i've added code that should
make the assumed claret position be the position determined by the
onClick, etc, triggers, unless the position that those triggers would
insert is outside of the bounds of the textrange object.

unfortunately, this only partially works. if you highlight the text,
and select within it, it'll still insert something at the top of the
page. if you do it again, however, it doesn't. also, if you refresh,
it doesn't insert it at the top of the page.

anyway, any help would be appreciated. here's the updated page:

http://www.frostjedi.com/terra/scripts/terra4.php
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Csaba Gabor | last post: by
5 posts views Thread by Jesper Rnn-Jensen | last post: by
9 posts views Thread by Paul Gorodyansky | last post: by
3 posts views Thread by arashamiri | last post: by
5 posts views Thread by bwucke | last post: by
5 posts views Thread by Robine | last post: by
4 posts views Thread by Keith Bentrup | last post: by
5 posts views Thread by a113n | last post: by
3 posts views Thread by saytri | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.