By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,148 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

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

P: n/a
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="insertDate();" where inside the
‘insertDate’ fn, I have document.form.dateField.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="insertDate();"...

<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 programmatically the
radio values?!?

beaucoup thanx in advance,
Chuck
==

Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ivo
"Charles M. Fish, Sr." <Am**************@notDot.com> wrote in message
news:3F**************@notDot.com...
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"...

<snip>

<input type=reset onclick="document.f.txt.value='whatever';">
doesn't work, but
<input type=reset onclick="setTimeout('document.f.txt.value=\'Hi.\'; ',1);">
has no probs.
HTH
Ivo
Jul 20 '05 #2

P: n/a
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:
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('document.order.orderDate.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:
"Charles M. Fish, Sr." <Am**************@notDot.com> wrote in message
news:3F**************@notDot.com...

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"...


<snip>

<input type=reset onclick="document.f.txt.value='whatever';">
doesn't work, but
<input type=reset
onclick="setTimeout('document.f.txt.value=\'Hi.\'; ',1);">
has no probs.
HTH
Ivo


Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.