Results 1 to 5 of 5

Thread: FORM Problem (also posted in javascript).

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    FORM Problem (also posted in javascript).

    Hey chaps,

    I have a textarea on a web page. I place a button and onclick I call a javascript function to get the value of the textarea, the javascript works. I place a form object around the textarea and the javascript can no longer see the textarea raising "Error: Textareax Undefined"

    Any ideas ????? This looks simplistic but I've boiled the whole problem down to the simplest form to try and work out why this is happening...

    Cheers.

    Chubby..

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: FORM Problem (also posted in javascript).

    Probably how you referenced the object. Try putting formname.objectname and see if that works.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    Re: FORM Problem (also posted in javascript).

    Quote Originally Posted by Ecniv
    Probably how you referenced the object. Try putting formname.objectname and see if that works.
    Did that, no amount of qualification makes a difference....

    Narrowed it down to something within the table around which the form is put. I put another form at the top of the page and it works without a problem... kinda given up, put some hidden fields into the form at the top that an onclick of a button will set from the table's controls and submit....

    pain in the a---- but still the page is way too complex to try and debug (a fair bit of DHTML)..

    Thanks

    Chubby..

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: FORM Problem (also posted in javascript).

    What code did you use in the first place?

    You could also try document.getElementById()

  5. #5
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: FORM Problem (also posted in javascript).

    You could do this:
    Code:
    <script>
       function showText(thisForm)
       {
          alert(thisForm.sometext.value);
       }
    </script>
    
    <form name="myform">
    <textarea name="sometext">Hello!</textarea>
    <input type="button" value="click me" onclick="showText(this.form)">
    </form>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width