IE6 Form and Its Properties After Submit

Discussion in 'Javascript' started by vunet, Oct 7, 2008.

  1. vunet

    vunet Guest

    Hello,

    My HTML form submits some values to a hidden iframe. However, this is
    done for file upload fields only. After file uploading is finished I
    am using this form to submit all other data (inputs, textareas, etc.)
    normally.
    The file upload mechanism is structured in the way that it sets form's
    enctype (multipart) and target to iframe dynamically and then resets
    to old values right after submit() method.
    This works ideally in most (maybe almost all) browsers but IE6.
    I learned that for IE6 it is not enctype but rather encoding property
    that needs to be set:

    http://msdn.microsoft.com/en-us/library/ms533745(VS.85).aspx (see
    Warning on the bottom)

    Fine, but when I set encoding, submit() the form, then I am unable to
    reset the form's properties such as encoding or target in IE6, because
    as I briefly heard IE6 loses its reference to the form after using
    submit().
    I am not sure how true this is because my alerts did show encoding and
    target properties in IE6 which, unfortunately, could not be reset.

    On another hand, I saw that some time pauses need to be applied to
    reset values after submit in IE6 but I am still looking into that.

    I need a solution for this or explanation of why it is happening. If
    anyone is aware of anything to help me move forward please suggest.
    Thanks.
    vunet, Oct 7, 2008
    #1
    1. Advertising

  2. vunet

    dhtml Guest

    vunet wrote:
    > Hello,
    >
    > My HTML form submits some values to a hidden iframe. However, this is
    > done for file upload fields only. After file uploading is finished I
    > am using this form to submit all other data (inputs, textareas, etc.)
    > normally.
    > The file upload mechanism is structured in the way that it sets form's
    > enctype (multipart) and target to iframe dynamically and then resets
    > to old values right after submit() method.
    > This works ideally in most (maybe almost all) browsers but IE6.
    > I learned that for IE6 it is not enctype but rather encoding property
    > that needs to be set:
    >
    > http://msdn.microsoft.com/en-us/library/ms533745(VS.85).aspx (see
    > Warning on the bottom)
    >
    > Fine, but when I set encoding, submit() the form, then I am unable to
    > reset the form's properties such as encoding or target in IE6, because
    > as I briefly heard IE6 loses its reference to the form after using
    > submit().
    > I am not sure how true this is because my alerts did show encoding and
    > target properties in IE6 which, unfortunately, could not be reset.
    >
    > On another hand, I saw that some time pauses need to be applied to
    > reset values after submit in IE6 but I am still looking into that.
    >
    > I need a solution for this or explanation of why it is happening. If
    > anyone is aware of anything to help me move forward please suggest.
    > Thanks.


    I can't personally test your code in IE6 but if you post your code here,
    in a simple, reduced example, neatly wrapped at about 72 characters,
    you'll be more likely to get help.

    Garrett
    dhtml, Oct 8, 2008
    #2
    1. Advertising

  3. vunet

    vunet Guest

    On Oct 8, 1:38 am, dhtml <> wrote:
    > vunet wrote:
    > > Hello,

    >
    > > My HTML form submits some values to a hidden iframe. However, this is
    > > done for file upload fields only. After file uploading is finished I
    > > am using this form to submit all other data (inputs, textareas, etc.)
    > > normally.
    > > The file upload mechanism is structured in the way that it sets form's
    > > enctype (multipart) and target to iframe dynamically and then resets
    > > to old values right after submit() method.
    > > This works ideally in most (maybe almost all) browsers but IE6.
    > > I learned that for IE6 it is not enctype but rather encoding property
    > > that needs to be set:

    >
    > >http://msdn.microsoft.com/en-us/library/ms533745(VS.85).aspx(see
    > > Warning on the bottom)

    >
    > > Fine, but when I set encoding, submit() the form, then I am unable to
    > > reset the form's properties such as encoding or target in IE6, because
    > > as I briefly heard IE6 loses its reference to the form after using
    > > submit().
    > > I am not sure how true this is because my alerts did show encoding and
    > > target properties in IE6 which, unfortunately, could not be reset.

    >
    > > On another hand, I saw that some time pauses need to be applied to
    > > reset values after submit in IE6 but I am still looking into that.

    >
    > > I need a solution for this or explanation of why it is happening. If
    > > anyone is aware of anything to help me move forward please suggest.
    > > Thanks.

    >
    > I can't personally test your code in IE6 but if you post your code here,
    > in a simple, reduced example, neatly wrapped at about 72 characters,
    > you'll be more likely to get help.
    >
    > Garrett


    The code is below and imagine there is a hidden Iframe with
    name="IFRAME_UPLOAD_TARGET":

    VAR IE6 = !!(window.attachEvent && !window.opera && !
    window.XMLHttpRequest)
    var rememberAction = (form.action) ? form.action : "";
    var rememberTarget = (form.target) ? form.target : null;
    var rememberEnctype = (form.enctype)? form.enctype : null;
    form.action = "page_to_upload_images/"
    form.target = "IFRAME_UPLOAD_TARGET";//THIS IS HIDDEN IFRAME
    if(ie6)form.enctype = "multipart/form-data";
    else form.encoding = "multipart/form-data";
    form.submit();
    form.action = rememberAction;//change back
    form.target = rememberTarget;
    form.enctype = rememberEnctype;
    vunet, Oct 8, 2008
    #3
  4. vunet

    vunet Guest

    On Oct 8, 2:41 pm, Conrad Lender <> wrote:
    > On 2008-10-08 19:57, vunet wrote:
    >
    > > VAR IE6 = !!(window.attachEvent && !window.opera && !
    > > window.XMLHttpRequest)
    > > if(ie6)form.enctype = "multipart/form-data";
    > >    else form.encoding = "multipart/form-data";

    >
    > "IE6" and "ie6"? Maybe that's just a typo, but you should be aware that
    > identifiers are case sensitive.
    >
    >   - Conrad


    that's just a typo.
    vunet, Oct 9, 2008
    #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. thunk
    Replies:
    1
    Views:
    303
    thunk
    Mar 30, 2010
  2. thunk
    Replies:
    0
    Views:
    469
    thunk
    Apr 1, 2010
  3. thunk
    Replies:
    14
    Views:
    612
    thunk
    Apr 3, 2010
  4. Marco Alting
    Replies:
    7
    Views:
    506
    Thomas 'PointedEars' Lahn
    Oct 30, 2003
  5. Replies:
    3
    Views:
    662
Loading...

Share This Page