Trying to execute a function *following* RESET clearing the textfields...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles M. Fish, Sr.

    #1

    Trying to execute a function *following* RESET clearing the textfields...

    I’m so tired from banging this problem around all day, I hope I can
    explain it succinctly & accurately.

    I want to execute a function immediately following a click on <input
    type="RESET"...

    The function will insert today’s date into a <input type="TEXT"… field.
    It does it just fine with <form onload="insertD ate();" where inside the
    ‘insertDate’ fn, I have document.form.d ateField.value = dateString. The
    closest I’ve been able to do anything to repopulate <input type=”TEXT”
    name=”dateField ”… is with the onMouseOut event handler associated with
    the <input type=”RESET”… object. Aaarrghh!

    Here’s kind of an example:

    <script>
    // global var
    var dateString = ""

    function insertDate()
    {
    // …code that assigns formatted string for today’s date
    dateString = dayname[weekday]+" "+day+" "+monthname[month]+" "+year;
    }
    </script>
    </head>
    <body...
    <form onLoad="insertD ate();"...

    <input type=”text” name=”dateField ” readonly>
    ..
    ..
    ..
    <input type="reset" name="reset" value="reset".. .
    on... I don’t know what (eventHandler) can execute a function call after
    RESET is executed>


    I’ve even tried a dummy (pseudo) reset where RESET is a mere ‘button’
    and I can call any function I want thru the onClick handler; but then
    I can’t restore radio buttons to their default (initialized at form
    load) values.

    Any assistance will be genuinely appreciated!

    Maybe you have solutions for both problems (automatic restoration of
    dateString following RESET *** AND *** reassigning programmaticall y the
    radio values?!?

    beaucoup thanx in advance,
    Chuck
    ==

  • Ivo

    #2
    Re: Trying to execute a function *following* RESET clearing the text fields...

    "Charles M. Fish, Sr." <AmandaReckonwi th@notDot.com> wrote in message
    news:3F6FA3D2.1 060604@notDot.c om...[color=blue]
    > I’m so tired from banging this problem around all day, I hope I can
    > explain it succinctly & accurately.
    >
    > I want to execute a function immediately following a click on <input
    > type="RESET"...
    >[/color]
    <snip>

    <input type=reset onclick="docume nt.f.txt.value= 'whatever';">
    doesn't work, but
    <input type=reset onclick="setTim eout('document. f.txt.value=\'H i.\';',1);">
    has no probs.
    HTH
    Ivo


    Comment

    • Charles M. Fish, Sr.

      #3
      Re: Trying to execute a function *following* RESET clearing the textfields...

      Whoops, please ignore my ignorance about the backslashes!

      I realize that they're for escape-apostrophe.

      Still, any way to plug in a variable, not literal, value in a <input
      type="text"... ???

      TIA,
      C
      ==

      Charles M. Fish, Sr. wrote:
      [color=blue]
      > Ivo, Hi... Thank you for your reply.
      >
      > I'm still having difficulties with getting something (*anything*) to
      > occur upon execution of <input type="reset"...
      >
      > I tried your suggested line (verbatim except for substituting order &
      > orderDate) and my Netscape | Tools | Web Development | Javascript
      > Console returns:
      >
      > Error: unterminated string literal
      > Source Code:
      > setTimeout('doc ument.order.ord erDate.value=\' Hi.\';',1);">
      >
      > I don't understand the pair of backslashes surrounding 'Hi. are they
      > supposed to swap a string literal for a variable?
      >
      > Again, I want to restore a variable( not a literal) to a readonly text
      > field after executing a true "reset".
      >
      > Is it possible?
      >
      > TIA
      > C
      > ==
      >
      > Ivo wrote:
      >[color=green]
      >> "Charles M. Fish, Sr." <AmandaReckonwi th@notDot.com> wrote in message
      >> news:3F6FA3D2.1 060604@notDot.c om...
      >>
      >>[color=darkred]
      >>> I’m so tired from banging this problem around all day, I hope I can
      >>> explain it succinctly & accurately.
      >>>
      >>> I want to execute a function immediately following a click on <input
      >>> type="RESET"...
      >>>
      >>>[/color]
      >>
      >> <snip>
      >>
      >> <input type=reset onclick="docume nt.f.txt.value= 'whatever';">
      >> doesn't work, but
      >> <input type=reset
      >> onclick="setTim eout('document. f.txt.value=\'H i.\';',1);">
      >> has no probs.
      >> HTH
      >> Ivo
      >>
      >>
      >>
      >>[/color]
      >[/color]

      Comment

      Working...