textarea problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yawnmoth

    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:

    Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!


    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! :)
  • Andrew Thompson

    #2
    Re: textarea problem

    On 14 Jun 2004 20:05:28 -0700, yawnmoth wrote:
    [color=blue]
    > http://www.geocities.com/terra1024/error-forms.html[/color]

    You might check into this first..
    <http://validator.w3.or g/check?uri=http://www.geocities.c om/terra1024/error-forms.html&char set=utf-8&doctype=HTML+ 4.01+Transition al>
    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

    Comment

    • yawnmoth

      #3
      Re: textarea problem

      On Tue, 15 Jun 2004 07:44:07 GMT, Andrew Thompson
      <SeeMySites@www .invalid> wrote:
      [color=blue]
      >On 14 Jun 2004 20:05:28 -0700, yawnmoth wrote:
      >[color=green]
      >> http://www.geocities.com/terra1024/error-forms.html[/color]
      >
      >You might check into this first..
      ><http://validator.w3.or g/check?uri=http://www.geocities.c om/terra1024/error-forms.html&char set=utf-8&doctype=HTML+ 4.01+Transition al>
      >Particularly errors 5 though 13, which
      >mention unmatched tags or similar..[/color]

      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 :(

      Comment

      • Andrew Thompson

        #4
        Re: textarea problem

        On Tue, 15 Jun 2004 17:09:03 GMT, yawnmoth wrote:[color=blue]
        > On Tue, 15 Jun 2004 07:44:07 GMT, Andrew Thompson wrote:[color=green]
        >>On 14 Jun 2004 20:05:28 -0700, yawnmoth wrote:
        >>[color=darkred]
        >>> http://www.geocities.com/terra1024/error-forms.html[/color]
        >>
        >>You might check into this first..
        >><http://validator.w3.or g/check?uri=http://www.geocities.c om/terra1024/error-forms.html&char set=utf-8&doctype=HTML+ 4.01+Transition al>[/color][/color]
        ....[color=blue]
        > all errors after, and including, 5 deal with the geocities code
        > addition for ad placement,[/color]

        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 ]
        [color=blue]
        >...and as such, there's not really a whole lot
        > i can do about that :([/color]

        ....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

        Comment

        • yawnmoth

          #5
          Re: textarea problem

          On Tue, 15 Jun 2004 19:10:08 GMT, Andrew Thompson
          <SeeMySites@www .invalid> wrote:
          [color=blue]
          >On Tue, 15 Jun 2004 17:09:03 GMT, yawnmoth wrote:[color=green]
          >> On Tue, 15 Jun 2004 07:44:07 GMT, Andrew Thompson wrote:[color=darkred]
          >>>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.or g/check?uri=http://www.geocities.c om/terra1024/error-forms.html&char set=utf-8&doctype=HTML+ 4.01+Transition al>[/color][/color]
          >...[color=green]
          >> all errors after, and including, 5 deal with the geocities code
          >> addition for ad placement,[/color]
          >
          >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 ]
          >[color=green]
          >>...and as such, there's not really a whole lot
          >> i can do about that :([/color]
          >
          >...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?[/color]

          sadly, no :(

          Comment

          • yawnmoth

            #6
            Re: textarea problem

            On 14 Jun 2004 20:05:28 -0700, terra1024@yahoo .com (yawnmoth) wrote:
            [color=blue]
            >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! :)[/color]

            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:


            Comment

            Working...