onsubmit

Discussion in 'HTML' started by larry, Sep 1, 2005.

  1. larry

    larry Guest

    I'm a newbie in Internet programming. I have created an HTML form
    using a Perl script. I previously wrote about a question which I still
    need some assistance with. In previous postings I received similar
    advice which I greatly appreciate. What I want to happen is that when
    I click on the submit button, a javascript function will run and then a
    perl script will be called:

    The advice I received was of the following form: To create a form
    using the onsubmit form attribute and to set any values I wanted to be
    sent to the perl script in hidden values input controls.
    The examples given were of the form:

    <form action="myPerlScript.pl" onsubmit="return
    someJavaScriptFuncti­on()>
    A Javascript function which populates hidden fields and return value
    true
    <input type = submit...>
    </form>

    This is not working for me and I'd appreciate if someone can tell me
    why. I'm guessing this a glaring error. First of all, the entire
    script is contained in one form:
    <form action="toBeChanged.pl" onsubmit="return do_processForm()">

    After this form declaration the Javascript function is declared
    ,followed by hidden fields which are populated when the Javascript
    function runs, followed by the HTML that creates the form and then
    ultimately the submit button.

    I am also trying to change the action value in the Javascript using the
    DOM document.form.action = x.pl because depending on certain form
    selections I want different script to be called. Any advice would be
    most appreciated.

    Thanks,
    Larry
    larry, Sep 1, 2005
    #1
    1. Advertising

  2. larry wrote:

    > I'm a newbie in Internet programming. I have created an HTML form
    > using a Perl script. I previously wrote about a question which I still
    > need some assistance with. In previous postings I received similar
    > advice which I greatly appreciate. What I want to happen is that when
    > I click on the submit button, a javascript function will run and then a
    > perl script will be called:
    >
    > The advice I received was of the following form: To create a form
    > using the onsubmit form attribute and to set any values I wanted to be
    > sent to the perl script in hidden values input controls.
    > The examples given were of the form:
    >
    > <form action="myPerlScript.pl" onsubmit="return
    > someJavaScriptFuncti­on()>
    > A Javascript function which populates hidden fields and return value
    > true
    > <input type = submit...>
    > </form>
    >
    > This is not working for me and I'd appreciate if someone can tell me
    > why. I'm guessing this a glaring error. First of all, the entire
    > script is contained in one form:
    > <form action="toBeChanged.pl" onsubmit="return do_processForm()">
    >
    > After this form declaration the Javascript function is declared
    > ,followed by hidden fields which are populated when the Javascript
    > function runs, followed by the HTML that creates the form and then
    > ultimately the submit button.


    What exactly is not working? Are the hidden values not set (probably same
    problem as below)?
    An URL to you document would greatly help us to help you.

    > I am also trying to change the action value in the Javascript using the
    > DOM document.form.action = x.pl


    This can certainly not work (this would imply that there can only be one
    form per document...). Give your form an id and use
    document.getElementById('myform').action = ...

    > because depending on certain form
    > selections I want different script to be called. Any advice would be
    > most appreciated.


    --
    Benjamin Niemann
    Email: pink at odahoda dot de
    WWW: http://www.odahoda.de/
    Benjamin Niemann, Sep 1, 2005
    #2
    1. Advertising

  3. larry

    Philip Ronan Guest

    "larry" wrote:

    > <form action="myPerlScript.pl" onsubmit="return
    > someJavaScriptFuncti­on()>


    That's an invalid function name.

    > A Javascript function which populates hidden fields and return value
    > true
    > <input type = submit...>


    "submit" should be in quotes. And no spaces either side of the "=" sign.

    > </form>
    >
    > This is not working for me and I'd appreciate if someone can tell me
    > why.


    It's not working? Try fixing the above errors. And remember to check that
    your computer is switched on. If you want some more helpful advice, please
    provide a URL and describe (a) what the script is supposed to do, and (b)
    what is actually happening.

    --
    phil [dot] ronan @ virgin [dot] net
    http://vzone.virgin.net/phil.ronan/
    Philip Ronan, Sep 1, 2005
    #3
    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. =?Utf-8?B?U25vd2JhbmsgSmlt?=

    Form-level onSubmit handler

    =?Utf-8?B?U25vd2JhbmsgSmlt?=, Feb 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    408
    Peter Blum
    Feb 21, 2004
  2. Replies:
    3
    Views:
    1,134
    bruce barker
    Feb 25, 2004
  3. =?Utf-8?B?Q3Jpc3RpYW4gQ2FybHNzb24=?=

    Re: Add onSubmit To Form?

    =?Utf-8?B?Q3Jpc3RpYW4gQ2FybHNzb24=?=, May 25, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    675
    Steven Cheng[MSFT]
    May 27, 2004
  4. Joeyej
    Replies:
    0
    Views:
    8,014
    Joeyej
    Jun 4, 2004
  5. Mark Rae

    Re: onsubmit Event in aspx page.

    Mark Rae, Aug 17, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    409
    Mark Rae
    Aug 17, 2004
Loading...

Share This Page