Good point. If that is the case just mimic Mathew's original function but
make the values simply '' and give it a different name...
Eg...
function eraseData()
{
document.getElementById('field1').value = '';
document.getElementById('field2').value = '';
document.getElementById('field3').value = '';
}
And make the onclick of the checkbox...
<input type="checkbox" onclick="if ( this.checked )
{copyData()}else{eraseData();}">
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-----Original Message-----
From: Matthew Walker [mailto:[EMAIL PROTECTED]
Sent: Monday, November 21, 2005 4:59 PM
To: CF-Talk
Subject: RE: JavaScript Autofill
It rather depends. Do you want to clear all the fields in the form (in
which case Bobby's suggestion) or only these particular fields? If a
user has checked the box then edited one of the values then unchecked
the box, what should happen? Should the box be cleared?
I would suggest instead of having a checkbox have a button. Then it
returns to its original state so you don't have to think about what
happens if it is "unpressed".
-----Original Message-----
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 22 November 2005 10:01 a.m.
To: CF-Talk
Subject: RE: JavaScript Autofill
One more thing Matthew.
What do I add to this code so that when I uncheck the box the values
disappear as well??
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224901
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54