Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Initializing additional variable to submit with an onChange

    Yesterday I had to leave before trying out the responses to actually using the onChange. However after trying the following:

    onChange="this.form.submit()"

    to submit an <OPTION> within a <SELECT> list (which works GREAT!) I discovered I need another piece of the puzzle.

    I need to initialize a variable called 'update2' to a non-null state so that when the form is submitted the PERL script can check if 'update2' is non-null, in which case it will return the completed form for correction.

    The original thread id is 12621.

    Thanks again to everyone that responded yesterday, and many thanks for any help today.

    UR

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Put this in the form

    <input type="hidden" name="update2" value="" />

    Shouldn't that work? If not, is the form POST or GET?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    New Coder
    Join Date
    Jan 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You'll have to excuse my long explaination. It's to help me clarify my situation. I'm sure you know all this anyway, but bear with me.

    The form (which uses the post method) has three submit buttons. CGI submits all the values in the form but only the value of the actual submit button that was clicked. Additional submit button values are not passed through CGI. OK, I think I'm clear. Here is the bit that sets up the submit buttons at the page bottom. (This little bit is brought into each page as needed. Keeping in mind that every page on this site is created dynamically by PERL scripts.)

    sub PFFooter
    {print "<TABLE cellspacing=0 align=center>";
    print " <TR><TD height=20>&nbsp;</TD>";
    print " <TR><TD align=center>";
    if($update1)
    {print "<INPUT class=sm type=submit name=update1 value=\"$update1\">";
    }
    if($update2)
    {print "<INPUT class=sm type=submit name=update2 value=\"$update2\">";
    }
    print "<INPUT class=sm type=submit name=exit value=\"$exit\">";
    print "<INPUT type=hidden name=exitto value=\"$exitto\">";
    print "</TD>";
    print "</TABLE>";
    print "</FORM>";
    print "</BODY>";
    print "</HTML>";
    PrintTag
    }


    The value of update1, update2 and exit are set at the start of the script like this:

    $update1 = 'UPDATE';
    $update2 = 'GET GROUP';
    $exitto = 'menuMaster.cgi';
    $exit = 'EXIT WITHOUT CHANGE';

    This works great as long as you actually click on the submit buttons. As you know I'd like JavaScript to submit the page when an onChange occurs (which you've shown me how to do), it's just a matter of getting it to submit a value for update2 when the event fires.

    Thanks,
    UR

    PS. update1 and update2 are in 'if' statements to allow for screens that only need one other button besides the EXIT button.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, it feels like we are working the symptom and not the problem.

    Why does the receiving Perl script NEED a blank value for update2 if update1 is pressed?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    New Coder
    Join Date
    Jan 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Beetle,

    OOPS we're passing each other. When the script is requested all values are null. When the onChange is executed all three of the submit buttons are still null. I need a way to make update2 something other than null, like '1', for instance.

    Then when the form is submitted, update1 will be null, update2 will be 1 and exit will be null. That way the PERL script will "know" that a request to retreive a group from the database has been submitted.

    When update1 = 1, the script updates the data base and when exit = 1 then the script exits to the script defined in $exitto.


    Thanks in advance for hanging in there with me. I really appreciate your time and effort.

    UR


  •  

    Posting Permissions

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