Problems with JavaScript submit()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Xeon

    Problems with JavaScript submit()

    Ok, the subject seemed not PHP related, but it does, as the submitted
    form will be read/processed by PHP.

    I have this HTML code:

    <form method="post" action="foo.php ">
    <select name="blah" onChange="javas cript:submit(); ">
    <option selected value="1">opt1</option>
    <option value="2">opt2</option>
    <option value="3">opt3</option>
    <option value="4">opt4</option>
    </select>
    <input type="submit" name="sub1" value="Submit 1">
    <input type="submit" name="sub2" value="Submit 2">
    <input type="submit" name="sub3" value="Submit 3">
    </form>

    Now, if there is a change on the drop-list, the form is submitted, but
    the value read on the submitted form won't change from the previous
    value. Say, if the previous value of the drop-list is 'opt1', then I
    change it to 'opt3'. The form is submitted, but the the submitted
    value is still 'opt1'. So how do I rectify this? This behaviour won't
    occur when the form is submitted by clicking any of the submit
    buttons(Submit 1, 2, 3).

    Any help appreciated
    TIA
  • Tony Marston

    #2
    Re: Problems with JavaScript submit()

    xdblade@zworg.c om (Xeon) wrote in message news:<78321f06. 0307211237.5103 7143@posting.go ogle.com>...[color=blue]
    > Ok, the subject seemed not PHP related, but it does, as the submitted
    > form will be read/processed by PHP.
    >
    > I have this HTML code:
    >
    > <form method="post" action="foo.php ">
    > <select name="blah" onChange="javas cript:submit(); ">
    > <option selected value="1">opt1</option>
    > <option value="2">opt2</option>
    > <option value="3">opt3</option>
    > <option value="4">opt4</option>
    > </select>
    > <input type="submit" name="sub1" value="Submit 1">
    > <input type="submit" name="sub2" value="Submit 2">
    > <input type="submit" name="sub3" value="Submit 3">
    > </form>
    >
    > Now, if there is a change on the drop-list, the form is submitted, but
    > the value read on the submitted form won't change from the previous
    > value. Say, if the previous value of the drop-list is 'opt1', then I
    > change it to 'opt3'. The form is submitted, but the the submitted
    > value is still 'opt1'. So how do I rectify this? This behaviour won't
    > occur when the form is submitted by clicking any of the submit
    > buttons(Submit 1, 2, 3).
    >
    > Any help appreciated
    > TIA[/color]

    PHP will process whatever values are sent to it. If your javascript is
    not sending the right values then this is a javascript problem.

    Tony Marston
    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

    Comment

    Working...