One more thing Matthew. What do I add to this code so that when I uncheck the box the values disappear as well??
-----Original Message----- From: Orlini, Robert Sent: Monday, November 21, 2005 3:49 PM To: '[email protected]' Subject: RE: JavaScript Autofill Perfect Matthew. Thanks. Got to brush up more on JavaScript. -----Original Message----- From: Matthew Walker [mailto:[EMAIL PROTECTED] Sent: Monday, November 21, 2005 3:35 PM To: CF-Talk Subject: RE: JavaScript Autofill You have two fields with the id "lname". Generally, you should only use an id once per page. That JavaScript hurts my eyes so I haven't bothered trying to understand it. Are you trying to copy a set of values from a set of hidden fields to a set of visible fields? Something like this is low tech but very easy to understand.... <script> function copyData() { document.getElementById('field1').value = document.getElementById('default1').value; document.getElementById('field2').value = document.getElementById('default2').value; document.getElementById('field3').value = document.getElementById('default3').value; } </script> <form> <input type="hidden" id="default1" value="Spare"> <input type="hidden" id="default2" value="Spare"> <input type="hidden" id="default3" value="Spare"> <input type="checkbox" onclick="if ( this.checked ) copyData()"> Field 1: <input name="field1" type="text" id="field1"> Field 2: <input name="field2" type="text" id="field2"> Field 3: <input name="field3" type="text" id="field3"> </form> One more thing Matthew. What do I add to this code so that when I uncheck the box the values disappear as well?? -----Original Message----- From: Orlini, Robert Sent: Monday, November 21, 2005 3:49 PM To: '[email protected]' Subject: RE: JavaScript Autofill Perfect Matthew. Thanks. Got to brush up more on JavaScript. -----Original Message----- From: Matthew Walker [mailto:[EMAIL PROTECTED] Sent: Monday, November 21, 2005 3:35 PM To: CF-Talk Subject: RE: JavaScript Autofill You have two fields with the id "lname". Generally, you should only use an id once per page. That JavaScript hurts my eyes so I haven't bothered trying to understand it. Are you trying to copy a set of values from a set of hidden fields to a set of visible fields? Something like this is low tech but very easy to understand.... <script> function copyData() { document.getElementById('field1').value = document.getElementById('default1').value; document.getElementById('field2').value = document.getElementById('default2').value; document.getElementById('field3').value = document.getElementById('default3').value; } </script> <form> <input type="hidden" id="default1" value="Spare"> <input type="hidden" id="default2" value="Spare"> <input type="hidden" id="default3" value="Spare"> <input type="checkbox" onclick="if ( this.checked ) copyData()"> Field 1: <input name="field1" type="text" id="field1"> Field 2: <input name="field2" type="text" id="field2"> Field 3: <input name="field3" type="text" id="field3"> </form> -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.13.4/176 - Release Date: 11/20/2005 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:224873 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

