Post by jadeye » Sat Mar 09, 2013 6:00 pm

Hello everyone,

I am trying to create a free VQMod:
1. That will add zipcode per zone in zone table and view.
2. Once a customer registers, by clicking on a Country->Zone,
Post Code will be automatically filled in - since alot of people do not remember their zip codes.
3. Thus enabling the admin to group several different customer shippments together.

I need help on some JS:

1. I am trying to write a select that will load a new select with onChange function that will populate a text input:
The following select is to populate the other select:
*this is the original code from customer_form.tpl

Code: Select all

<td><select name="address[<?php echo $address_row; ?>][country_id]" 
id="address[<?php echo $address_row; ?>][country_id]"
onchange="$('select[name=\'address[<?php echo $address_row; ?>]
[zone_id]\']').load('index.php?route=sale/customer/zone&token=<?php echo $token;
 ?>&country_id=' + this.value + '&zone_id=<?php echo $address['zone_id']; ?>');">
So country_id populates zone_id.

2. Now I am trying to trigger change on zone_id in order to populate a zipcode text input so:
customer_form.tpl
* I have made the necessary changed to zone table

Code: Select all

<script type="text/javascript"><!--
$('select[name=\'address[<?php echo $address_row; ?>][zone_id]\']')
.load('index.php?route=sale/customer/zone&token=<?php echo $token; ?>&country_id=<?php echo $address['country_id']; ?>
&zone_id=<?php echo $address['zone_id']; ?>').change(function() { 
$('input[name=\'address[<?php echo $address_row; ?>][postcode]\']'
.val('<?php echo $address['zone_id'] ?>'))
});
$('select[name=\'address[<?php echo $address_row; ?>][zone_id]\']').trigger('change');
//--></script> 
The select zone_id is populated but does not trigger change in various ways I have tried. Any ideas??

Can anyone tell me what I am doping wrong or point me at the right direction?? O0

Thanx.

Imagehttp://nwg.co.il/
“Compassion is the basis of morality.”
― Arthur Schopenhauer


New member

Posts

Joined
Sun Jul 15, 2012 12:35 am
Who is online

Users browsing this forum: No registered users and 7 guests