Pasting multiple lines into a single line text box

Discussion in 'HTML' started by Adam Plocher, Jun 13, 2007.

  1. Adam Plocher

    Adam Plocher Guest

    Hello, I have an <input type="text" /> textbox that when the Enter key
    is pressed, it's text gets processed by a javascript and it clears the
    contents of the textbox. I was wondering if it's possible to have it
    handle pasting multiple-lines of text into it, so that on every line
    break it get's processed by javascript then clears the text field and
    handles the next line.

    I know IE has onpaste and onbeforepaste events, but I still can't see
    how to do what I want with those. Any suggestions? I might be able
    to use a textarea and have it mimic the behavior of a single line text
    box...

    Thanks
    -Adam
     
    Adam Plocher, Jun 13, 2007
    #1
    1. Advertising

  2. Adam Plocher wrote:
    > Hello, I have an <input type="text" /> textbox that when the Enter key
    > is pressed, it's text gets processed by a javascript and it clears the
    > contents of the textbox. I was wondering if it's possible to have it
    > handle pasting multiple-lines of text into it, so that on every line
    > break it get's processed by javascript then clears the text field and
    > handles the next line.
    >
    > I know IE has onpaste and onbeforepaste events, but I still can't see
    > how to do what I want with those. Any suggestions? I might be able
    > to use a textarea and have it mimic the behavior of a single line text
    > box...


    ?? Use the right tools for the application, especially where there is
    already a tool for your needs.

    textbox => single line of input
    textarea => multiple lines of input

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jun 13, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wladimir Borsov
    Replies:
    0
    Views:
    372
    Wladimir Borsov
    Aug 28, 2003
  2. Replies:
    4
    Views:
    962
    M.E.Farmer
    Feb 13, 2005
  3. Markus Dehmann
    Replies:
    1
    Views:
    138
    Tad McClellan
    Sep 26, 2006
  4. ela
    Replies:
    12
    Views:
    355
    Uri Guttman
    Apr 6, 2009
  5. Cah Sableng
    Replies:
    0
    Views:
    245
    Cah Sableng
    Apr 23, 2007
Loading...

Share This Page