SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onSubmit not working in a layer

    This is really frustrating.

    I've got some form code that works fine on a regular HTML page, but when I put it in a layer, its screwy.

    Code:
    <form action="doform.php" method="POST" onSubmit="myfunction()">

    Basically I want to call the function and submit the form at the same time. Works fine on a plain page, but when I try in a layer, it goes to the "doform.php", but it doesn't submit any of the form values! (When I change the method to GET, it goes to "doform.php?" with no variables after the ?)

    If I remove the "onSubmit" everything works.

    Thanks for the help!

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you should tell us what your function does.

  3. #3
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The function calls another layer to the top.

    The doform.php just echoes the values submitted from the form.

    When the form is in a layer and is submitted, $HTTP_POST_VARS is completely empty.

    Don't know Javascript too well - I must be missing something...
    Last edited by Jujubee; Jun 9, 2001 at 16:48.

  4. #4
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not forego the action and method altogether and use your Javascript function to submit the form after bringing that layer to the top.

  5. #5
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please forgive my ignorance, but how would I submit the form via javascript?

  6. #6
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your last line of your function should read

    document.yourformname.submit();


Bookmarks

Posting Permissions

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