IE8 and below <input type="image"> value work around

Posted by kielie on Stack Overflow See other posts from Stack Overflow or by kielie
Published on 2010-04-15T13:03:32Z Indexed on 2010/04/15 13:13 UTC
Read the original article Hit count: 172

Filed under:
|
|
|

Hi guys, I have a slight problem, I am trying to capture the input of two buttons, one yes, one no, into a database but for some reason the database doesn't always show the value of the button clicked, it just shows up blank.

                <form  action="refer.php" method="post" id="formID" >
            <div class="prompt_container" style="float: left;">
                    <span class="prompt_item"><input type="image" src="images/yes.jpg" alt="submit" value="yes" onclick="this.disabled=true,this.form.submit();" /></span>
                    <input type="hidden" name="refer" value="yes">
            </div>
            </form>

            <form action="thank_you.php" method="post" id="formID" >
            <div class="prompt_container" style="float: right;">
                    <span class="prompt_item"><input type="image" src="images/no.jpg" alt="submit" value="no" onclick="this.disabled=true,this.form.submit();" /></span>
                    <input type="hidden" name="refer" value="no" >
            </div>
            </form>

Apparently anything lower than IE8 will ignore the value attribute of all form inputs.

How could I get this to work properly in all browsers? jQuery or Javascript maybe?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html