Results 1 to 3 of 3

Thread: submit form

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    submit form

    <form name=kk action="file.php">
    <input type=text name=kkk value="Hi">
    </Form>

    How can I submit this form auto. using JavaScript code?

  2. #2
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    I believe its document.kk.submit(); but I may be wrong
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  3. #3
    Junior Member
    Join Date
    Dec 2001
    Location
    Northern Michigan
    Posts
    24
    There are a couple ways you could do this. Depending on how you want the form to be submitted. If you want a button to be clicked to do it and that is all you have in the form just use a submit button:

    <input type="submit" value="the text you want on the button">

    If you have other things that you want to do with javascript then you can use an onClick event on a button or any other javascript event to call a function.

    In the <head> section of your page, you will need to create the function:

    <head>
    <script language="javascript">

    function submitForm() {

    document.kk.submit()

    }

    </script>
    </head>


    Then you would call the function from a button or just about any other object that can use an onClick event, ie:

    <input type="button" value"Submit or somthing" onClick="submitForm()">

    This will call the function in the head section of your page. Also make sure that you use a method for your form. You can do this in the form tag. simply add a method="post" section to your form. If you wanted to use the javascript function you could also add it there by adding the following to the function before the submit:

    document.kk.method = "post"

    -Korendir

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