473,473 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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="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
2 2618
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Copeland | last post by:
In the following code I am calculating 2 values when the "Compute Distance" button is pressed. I would like to find a way to "return" both value to the form so I can show both when the calculation...
2
by: RelaxoRy | last post by:
If I fill out the textfields properly with Name, Email etc in a row it is fine. But if I fill out, for example, my Name, then tab twice, it clears my entered value. How do I stop this? All I...
2
by: Matt | last post by:
i need to implement a clear button to clear all the fields in the form, but i am thinking i can just use reset button. <input type="reset" name="reset" value="CLEAR"> The first thought is...
7
by: Kermit Piper | last post by:
Hello, How can you clear session variables when a reset button is pressed? I thought I might be able to do something like: <% If request.form("Reset") = "Reset" then Session("variable") =...
5
by: mk | last post by:
Greetings all - im new to this newsgroup so pls dont flame me :p I need some help! Please view the html below in a browser. Or goto this url -http://firebrain.co.uk/java-problem.htm (Assuming...
1
by: comp.lang.php | last post by:
I thought my function would have accomplished just that: if (!function_exists('resetCSV')) { function &resetCSV($fullFileName, $path, $willClearFile = false) { ...
5
by: pat270881 | last post by:
hello, i should implement this class: namespace test_1 { class statistician { public: // CONSTRUCTOR
5
by: comp.lang.php | last post by:
// NEW 11/27/2006: FINALLY, IF YOU ADDED OR DELETED OR DID ANY KIND OF FORM ACTION SUCCESSFULLY, DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA $_POST if ($_POST && (!is_array($leaseObj->errorArray)...
5
by: karsagarwal | last post by:
I have a bounded form and after I click the button to update/save. THe fields are still there. Is there a way to clear off the fields in the bounded form. Thanks, SA Here's the code that I...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.