Grow your CSS skills. Land your dream job.

Html5 problem IE9

  • # December 5, 2012 at 1:32 pm

    Hi,
    currently I’ve a strange problem I don’t understand.

    I’ve created a HTML5 Form and for IE I’ve included a placeholder shim.
    The Form has two buttons one for submit and another one for downloading a PDF.

    I’ve created a small JQuery script which basically validates a few form fields if everything is alright it submits everything to process.php and then resets the form fields to their initial values…

    The problem starts with IE while trying to reset the form fields it does not work.
    But if you fill out all required fields and hit the download button magically the form fields resetting! That drives me nuts because that seems to be kind of a default behavior?

    I wonder how I could write a function which works in all browsers to reset the form fields to their placeholder text…

    function resetform() {
    formid.find(“input”).each(function () {
    jQuery(this).val(“”);
    })
    formid.find(“textarea”).val(“”);
    emailsend = false;
    }

    Strange in all other Browsers this works fine.

    kindest regards,
    Marc

    # December 5, 2012 at 9:37 pm

    Why not just use the standard reset method that all browsers have built into them?

    function resetform() {
    formid.get(0).reset();
    emailsend = false;
    }

    # December 6, 2012 at 10:19 am

    Hi,
    good question I dont remember:)
    But your code works perfectly thank you very much for this…

    There is just s small issue left in IE after the reset all fields are totally blank while other browsers showing the placeholder text instead. When I click in one of those totally blank fields in IE the placeholder text is shown again… Thats kinda ugly to me is there a way to solve this too?

    regards
    Marc

    # December 8, 2012 at 8:11 pm

    > There is just s small issue left in IE after the reset all fields are totally blank while other browsers showing the placeholder text instead. When I click in one of those totally blank fields in IE the placeholder text is shown again

    You could maybe use something really ugly like the following which should work.

    function resetform() {
    formid.get(0).reset();
    emailsend = false;

    $(‘input, textarea’, formid).each(function() {
    this.focus();
    });

    $(‘input:first’, formid).get(0).focus();
    }

    # December 9, 2012 at 5:27 pm

    [ironie on]IE rulez[ironie off]
    You’re right it really works even if its ugly…

    Thank you

    # December 10, 2012 at 6:36 am

    >[ironie on]IE rulez[ironie off]

    Spellcheck off too…apparently. :_

    # December 15, 2012 at 1:41 am

    Yeah sorry this happend if you think german and writen english :(

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".