Help restore data from form fields in Internet Explorer

Discussion in 'Javascript' started by Tim Tyler, Nov 10, 2003.

  1. Tim Tyler

    Tim Tyler Guest

    The user has come back to my page - and I have session data held in
    hidden form fields that I want to restore.

    Getting these values using Javascript works fine in Mozilla Firebird - and
    the like - but there's a problem with Internet Explorer (6).

    IE apparently fills in the form fields the way they were *after*
    the page is loaded.

    Executing Javascript while the page is loading gets the original
    default values - not the ones left stored in the form fields when
    the page was last exited :-|

    I'm sure this must be a common issue - can any kind soul point me
    to the best way to work around the problem?

    Thanks in advance for any assistance!
    --
    __________
    |im |yler http://timtyler.org/ Remove lock to reply.
    Tim Tyler, Nov 10, 2003
    #1
    1. Advertising

  2. Tim Tyler

    Tim Tyler Guest

    I, Tim Tyler <> wrote or quoted:

    > The user has come back to my page - and I have session data held in
    > hidden form fields that I want to restore.
    >
    > Getting these values using Javascript works fine in Mozilla Firebird - and
    > the like - but there's a problem with Internet Explorer (6).
    >
    > IE apparently fills in the form fields the way they were *after*
    > the page is loaded.
    >
    > Executing Javascript while the page is loading gets the original
    > default values - not the ones left stored in the form fields when
    > the page was last exited :-|
    >
    > I'm sure this must be a common issue - can any kind soul point me
    > to the best way to work around the problem?


    <body onLoad="javascript:restore_state_from_form_fields('test');">

    ....is enough, it seems.
    --
    __________
    |im |yler http://timtyler.org/ Remove lock to reply.
    Tim Tyler, Nov 10, 2003
    #2
    1. Advertising

  3. Tim Tyler wrote:

    > <body onLoad="javascript:restore_state_from_form_fields('test');">
    >
    > ....is enough, it seems.


    Remove the `javascript:', URIs are wrong here and a label is not needed
    but will cause problems.

    Instead, define the default scripting language in the `head' element:

    <meta http-equiv="Content-Script-Type" content="text/javascript">


    PointedEars
    Thomas 'PointedEars' Lahn, Nov 11, 2003
    #3
  4. "Thomas 'PointedEars' Lahn" <> wrote in message
    news:boqupk$1ft23v$-berlin.de...
    >><body onLoad="javascript:restore_state_from_form_fields('test');">
    >>
    >> ....is enough, it seems.

    >
    >Remove the `javascript:', URIs are wrong here and a label is
    >not needed but will cause problems.

    <snip>

    I have never seen any evidence of the use of superfluous labels in the
    internally generated event handling functions causing problems, unlike
    the use of javascript: URIs in HREF attributes (which certainly do cause
    undesirable side effects). Of course because IE would treat the
    'javascript:' as an indicator of the type of script language to use for
    the attribute code it would be inadvisable to use it as a label in that
    context as the label would be missing form the generated function on IE,
    but its inclusion does seem to be harmless when it is treated as a label
    but never referred to as such.

    I would not recommend prefixing event handling attribute string values
    with 'javascript:' (assuming that JavaScript is the default (and/or
    only) language anyway), but the worst I would say about it is that it is
    an unnecessary 11 bytes of download that servers no practical purpose in
    normal use and may blur the distinction between event handling
    attributes and (the inadvisable use of) javascript: HREFs in the mind of
    the code author.

    Richard.
    Richard Cornford, Nov 11, 2003
    #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. cmay
    Replies:
    0
    Views:
    1,128
  2. Ed Hauptman
    Replies:
    7
    Views:
    1,012
    Ed Hauptman
    Aug 7, 2009
  3. JohnathanKong

    internet explorer cannot read post data from form

    JohnathanKong, Oct 18, 2007, in forum: ASP General
    Replies:
    0
    Views:
    253
    JohnathanKong
    Oct 18, 2007
  4. John Smith
    Replies:
    1
    Views:
    138
    Evertjan.
    Mar 12, 2005
  5. Thomas
    Replies:
    6
    Views:
    175
Loading...

Share This Page