Input Submits in Explorer

Discussion in 'Javascript' started by David Williams, Oct 31, 2007.

  1. Hello all, I need help submitting this
    data to a form which works in Firefox
    but not IE 7. I have an image (but.bmp)
    that when clicked, submits the data to the
    next php page. Works fine in Firefox. Does
    not work in IE so I made a hidden input
    field which changes value via the following
    javascript:

    onClick="document.myform.hiddenObject.value=this.value"

    The this.value seems to be the problem because
    it is not evaluating to 5



    The this.value seems to be the problem
    because it is not evaluating to 5 like it
    should. Is this not the proper syntax? I did
    a view source on the page and everything looks
    good except the this.value. The browser takes that
    literally ( this.value ) rather than evaluating
    it to (5)





    Here is the code:
    Thanks for any help


    <title>Test</title>

    </head>
    <body>

    <?
    $temp_id=5;
    $name="temp_id1";
    ?>

    </body>

    <form name="myform" action="page2.php" method="post">
    <INPUT TYPE="hidden" NAME="hiddenObject" VALUE="">

    <input type="image"
    src="but.bmp"

    name="<?php echo $name; ?>"
    value="<?php echo $temp_id;?>"
    onClick="document.myform.hiddenObject.value=this.value"
    >


    </form>

    </html>
















    --
    David Williams
    Georgia Institute of Technology, Atlanta Georgia, 30332
    Email:
     
    David Williams, Oct 31, 2007
    #1
    1. Advertising

  2. David Williams

    RobG Guest

    On Oct 31, 11:03 am, David Williams <> wrote:
    > Hello all, I need help submitting this
    > data to a form which works in Firefox
    > but not IE 7. I have an image (but.bmp)
    > that when clicked, submits the data to the
    > next php page. Works fine in Firefox. Does
    > not work in IE so I made a hidden input
    > field which changes value via the following
    > javascript:
    >
    > onClick="document.myform.hiddenObject.value=this.value"


    IE does not include the value of the input type image when submitting
    a form, it only sends the x and y coordinates. :-(


    > The this.value seems to be the problem because
    > it is not evaluating to 5


    It should evaluate to whatever the value of the control has been set
    to, the following simple test works for me in IE 6:

    <form>
    <input type="hidden" name="hiddenObject" value="">
    <input type="image" src="foo.gif" name="steve" onclick="
    this.form.hiddenObject.value = this.value;
    " value="27">
    </form>


    > The this.value seems to be the problem
    > because it is not evaluating to 5 like it
    > should.


    Use an alert to see the value before the form is posted.


    > Is this not the proper syntax? I did
    > a view source on the page and everything looks
    > good except the this.value. The browser takes that
    > literally ( this.value ) rather than evaluating
    > it to (5)


    That may be a result of the value of the onclick attribute not being
    properly quoted, however since you didn't post the page source we
    can't tell. :)


    > Here is the code:
    > Thanks for any help
    >
    > <title>Test</title>
    >
    > </head>
    > <body>
    >
    > <?
    > $temp_id=5;
    > $name="temp_id1";
    > ?>


    Please don't post server code, use view source in a browser to post
    what the client is actually getting.

    [...]


    --
    Rob
     
    RobG, Oct 31, 2007
    #2
    1. Advertising

  3. Good point about posting the browser code.
    What I originally posted actually works, it just does not work in a loop.
    I have hacked ( I don't like I how I did it ) the problem by
    having a differently named hiddenObject name for each iteration of the loop.

    I will post some more if I figure out how to do it the right way i.e.
    using the this.value

    Thanks
    David


    --
    David Williams
    Georgia Institute of Technology, Atlanta Georgia, 30332
    Email:
     
    David Williams, Oct 31, 2007
    #3
  4. David Williams

    RobG Guest

    On Nov 1, 2:47 am, David Williams <> wrote:
    > Good point about posting the browser code.
    > What I originally posted actually works, it just does not work in a loop.
    > I have hacked ( I don't like I how I did it ) the problem by
    > having a differently named hiddenObject name for each iteration of the loop.
    >
    > I will post some more if I figure out how to do it the right way i.e.
    > using the this.value


    If you post the code you are using now (or a useful section of it) you
    might get advice on how to "do it properly" now. :)

    I can guess that your loop either incorrectly increments or you are
    not getting the value you expect for the this keyword. I can't help
    further without seeing the code and some of the related HTML.


    --
    Rob
     
    RobG, Nov 1, 2007
    #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. Robert V
    Replies:
    1
    Views:
    1,195
    Jeremy Fluhmann
    Jul 21, 2003
  2. Scott M.

    Run JavaScript before Form Submits

    Scott M., Nov 17, 2003, in forum: ASP .Net
    Replies:
    14
    Views:
    7,147
    Joe Gass
    Nov 18, 2003
  3. Stan
    Replies:
    1
    Views:
    2,552
    Jacob Yang [MSFT]
    Dec 3, 2003
  4. jshanman

    input image submits x,y

    jshanman, Sep 30, 2008, in forum: HTML
    Replies:
    8
    Views:
    668
  5. okey
    Replies:
    3
    Views:
    96
    Thomas 'PointedEars' Lahn
    Oct 3, 2009
Loading...

Share This Page