/[drupal]/contributions/modules/address/address.js
ViewVC logotype

Contents of /contributions/modules/address/address.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1.1.1 - (show annotations) (download) (as text) (vendor branch)
Tue Jan 29 17:06:27 2008 UTC (21 months, 4 weeks ago) by brmassa
Branch: MAIN, brmassa
CVS Tags: HEAD, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/javascript


1 /**
2 * $Id: $
3 * @file address.js
4 * Autocompletion for Province field.
5 * This jQuery function will force the Province field
6 * to autcomplete the pronvice for a given country.
7 */
8
9 Drupal.behaviors.address = function(context) {
10 // Use this ID to 'simplify' the callings
11 var id = '#edit-address-';
12
13 // Record the original URL
14 var url = Drupal.settings.absPath + '/admin/settings/address/autocomplete/';
15
16 // Get all address
17 for (var n = 0; true; n++) {
18 // Check if this Field exists.
19 // If not, stop the script
20 if (!$(id + n +'-country').length) {
21 break;
22 }
23
24 // Set the country code at the beginning
25 if ($(id + n +'-country').val()) {
26 $(id + n +'-province-autocomplete').val(url + $(id + n +'-country').val());
27 }
28
29 // Change the country code everytime the country field changes
30 $(id + n +'-country').change(function() {
31 // alert(url + $(this).val());
32 $(id + n +'-province-autocomplete').val(url + $(this).val());
33 // Drupal.behaviors.autocomplete();
34 })
35 }
36 };

  ViewVC Help
Powered by ViewVC 1.1.2