Ok, I say "uncle" I've tried and tried this code for giving the option to use previously entered data to fill in other fields on the form (it's a long form that can be seen here:
http://asnwonline.com/2009/index.php?option=com_chronocontact&Itemid=38)
What I want to do is give them the option to auto populate the jobsite info with the requester info by clicking the box "same as requester" (eventually I will offer the same option for billing details if I can get this to work"
I have added this code to my form html:
<!--begin autofill code for jobsite //-->
<div class="form_item">
<div class="form_element cf_checkbox">
<input type="checkbox" name="jobsite" onclick="FillJob(this.form)">
Same as Requester.
<div class="cfclear"> </div>
</div>
<!-- end auto code for jobsite //-->
and this code in the form javascript box:
function FillJob(f) {
if(f.jobsite.checked == true) {
f.rfname.value = f.onsite.value;
f.rphone.value = f.onsitephone.value;
f.raddress1.value = f.onsite1.value;
f.raddress2.value = f.onsiteroom.value;
f.rcity.value = f.onsitecity.value;
f.rstate.value = f.onsitestate.value;
f.rzip.value = f.onsitezip.value;
}
}
I have "save to database before email" checked. (wasn't sure if this was needed)
But when you check the "same as requester" checkbox on the form the Requester info disappears and nothing is entered into the jobsite details. Help??