Current location: Hot Scripts Forums » General Web Coding » JavaScript » Javascript help - same as customer info script issue


Javascript help - same as customer info script issue

Reply
  #1 (permalink)  
Old 04-23-08, 09:02 PM
izzysanime izzysanime is offline
Newbie Coder
 
Join Date: Sep 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Javascript help - same as customer info script issue

Hi,

I have a form feature that will copy the already inputed form given by the visitor (eg: name, address, zip) and when a check box is checked it will put that form info again into the pickup address, and then another check box that will put the same info into the delivery address area.

The issue is that if the visitor does not enter the info in the first step area that the script grabs from, it will remove the form info when the visitor does go to the first step. And if the visitor decides to change something in either field it will remove everything. Any ideas? Here is the code :

Code:
<script type="text/javascript" language="javascript">
function set_billing(box) 
{ 
var f = box.form, b_which = box.checked, from_el, to_el, i = 0;
var fld_name = new Array('customerInfoBusiness' , 'customerInfoLastName' , 'customerInfoFirstName' ,'customerInfoAddress' ,'customerInfoCity' ,'customerInfoState' ,'customerInfoZip' ,'customerInfoPhones' , '');
while (from_el = f[fld_name[i]])
{ 
to_el = f['p' + fld_name[i++]];
to_el.value = b_which ? from_el.value : '';
if (to_el.readOnly != null)
to_el.readOnly = b_which ? true : false;
else to_el.onfocus = b_which ? function() {this.blur();
}
: null;
}
}
</script>

<script type="text/javascript" language="javascript">
function set_deliver(box) 
{ 
var f = box.form, b_which = box.checked, from_el, to_el, i = 0;
var fld_name = new Array('customerInfoBusiness' , 'customerInfoLastName' , 'customerInfoFirstName' ,'customerInfoAddress' ,'customerInfoCity' ,'customerInfoState' ,'customerInfoZip' ,'customerInfoPhones');
while (from_el = f[fld_name[i]])
{ 
to_el = f['d' + fld_name[i++]];
to_el.value = b_which ? from_el.value : '';
if (to_el.readOnly != null)
to_el.readOnly = b_which ? true : false;
else to_el.onfocus = b_which ? function() {this.blur();
}
: null;
}
}
</script>
This is the code for the first step form fields :

Code:
<input name="customerInfoLastName" id="customerInfoLastName" type="text" class="form"
				onchange="set_billing(billingaddrsame);set_deliver(deliveraddrsame)(billingaddrsame)" size="20"
	  			  value=""
				>
Let me know if you need any more info.

Thanks,
Josh
Reply With Quote
  #2 (permalink)  
Old 04-24-08, 09:37 AM
izzysanime izzysanime is offline
Newbie Coder
 
Join Date: Sep 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
or if anyone know of a script that can do the same thing with out this issue, send me the link

Thanks,
Josh
Reply With Quote
  #3 (permalink)  
Old 04-24-08, 10:00 AM
izzysanime izzysanime is offline
Newbie Coder
 
Join Date: Sep 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
I just tried removing the
Code:
 onchange="set_billing(billingaddrsame);set_deliver(deliveraddrsame)"
that is at the first step. It appears to not have that glitch now and it still copies the info when the check box is checked. BUT it wont automatically change the copied information when the visitor changes a field in step 1.

Thanks,
Josh
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing a script to collect info from Web-pages. kamesh419 Script Requests 0 10-05-05 05:03 PM
PHP script problem (please help) osmanmumtaz PHP 0 05-24-05 07:29 AM
Need a simple image with info text script (I can even pay you for this) nezbie Script Requests 2 04-05-04 09:47 AM
PHP to MySQL script question...(using a field to update info in MySQL) DisneyFan25863 PHP 4 11-02-03 03:31 AM
Looking 4 missed JavaScript script from HotScripts masrocha JavaScript 0 06-25-03 06:40 PM


All times are GMT -5. The time now is 11:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.