Value returned from Perl or Javascript?

Discussion in 'Javascript' started by amerar@iwc.net, Jan 20, 2006.

  1. Guest

    Hi All,

    I have a form which has some Javascript validation. On my form there
    is a button, and, if that button is selected or clicked, then I want to
    set a variable to one value and then pass that along to the Perl/CGI
    program. If the button was not clicked, I want to set the variable to
    a different value,,,,,,,,,,

    If there a way for me to do this? I'm lost on how to return the value
    back to the Perl scipt, if my thought process is even
    correct.............

    Thanks.
    , Jan 20, 2006
    #1
    1. Advertising

  2. wrote:

    > I have a form which has some Javascript validation. On my form there
    > is a button, and, if that button is selected or clicked, then I want to
    > set a variable to one value and then pass that along to the Perl/CGI
    > program. If the button was not clicked, I want to set the variable to
    > a different value,,,,,,,,,,


    <input type="submit" name="mySubmit" value="Submit">

    my $q = CGI->new();
    my $submit = $q->param('mySubmit');
    if (defined $submit) {
    print $submit;
    }

    No need for JavaScript.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Jan 20, 2006
    #2
    1. Advertising

  3. Guest

    David,

    Not sure that is what I want. I already have the form with several
    buttons and text boxes on it. This particular button has an 'onclick'
    event which validates some of the fields. Once that is done, it will
    go to the server and run the Perl program.

    If this button was clicked, I want to set some sort of variable so I
    know in my Perl program that this button was clicked.......
    , Jan 20, 2006
    #3
  4. wrote:

    > Not sure that is what I want.


    Not sure what is what you want?

    http://www.safalra.com/special/googlegroupsreply/
    http://oakroadsystems.com/genl/unice.htm#quote

    > I already have the form with several buttons and text boxes on it. This
    > particular button has an 'onclick' event which validates some of the
    > fields. Once that is done, it will go to the server and run the Perl
    > program.


    So make sure you are doing that by having it as a submit button, and then
    returning true or false from the event handler (and not calling the
    submit() method of teh form object).

    > If this button was clicked, I want to set some sort of variable so I
    > know in my Perl program that this button was clicked.......


    And by giving it a unique combination of name and value, as I suggested
    previously, that is exactly what you'll be doing.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Jan 20, 2006
    #4
    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. Jason Shohet
    Replies:
    16
    Views:
    808
  2. Amadelle
    Replies:
    1
    Views:
    2,654
    Amadelle
    Jun 5, 2004
  3. Jiggaz
    Replies:
    2
    Views:
    2,198
    Todd Casey
    Jul 8, 2004
  4. Eric
    Replies:
    6
    Views:
    1,677
    -berlin.de
    Feb 27, 2007
  5. mike
    Replies:
    3
    Views:
    176
Loading...

Share This Page