I've managed to install the module without problems (i think).

Now, I'm having trouble understanding the structure of the CSV file and how to use the module in CCK.

I want a user to identify the Province and City where he is from. (Where, after selecting a Province, he is limited to the Cities for that Province only) Do I create a Fixed Data fields for both items, province and city?

In this case, should my CSV file look like the following?
Prov1, City1
Prov1, City2
Prov2, City1
Prov2, City2
Prov3, City1
Prov4, City1

How do I set the value for the City field?

I tried searching for help documents or and previous posts, but I can't seem to find any. Any links to documentation about this module will be helpful.

Thanks.

PS
We have about 1,500 towns and 70 provinces.

CommentFileSizeAuthor
#4 prov-town.csv_.txt482 bytestumnus

Comments

tumnus’s picture

Version: » 5.x-1.2

btw, I am using version 5.x-1.2

markfoodyburton’s picture

Now, I'm having trouble understanding the structure of the CSV file and
how to use the module in CCK.

I want a user to identify the Province and City where he is from.
(Where, after selecting a Province, he is limited to the Cities for that
Province only) Do I create a Fixed Data fields for both items, province
and city?

Just a single FixedDataDropdown should do the job nicely!

In this case, should my CSV file look like the following?
Prov1, City1
Prov1, City2
Prov2, City1
Prov2, City2
Prov3, City1
Prov4, City1

Looks perfect,

So, you now need to create your CCK field type, and when you are doing so, you'll see that there is a place to "upload" the CSV file, (as above). Then you need to make sure that the regular expression correctly extracts the province and city, and with luck, your done. I'd suggest trying a small file of a few entries first, get that working, then go for the big file.

Then the user should see a free text area where they start typing in the province, which will auto-complete - and then the city drop down will be filled in with the names of the city's in the province....

Cheers

Mark.

markfoodyburton’s picture

Now, I'm having trouble understanding the structure of the CSV file and
how to use the module in CCK.

I want a user to identify the Province and City where he is from.
(Where, after selecting a Province, he is limited to the Cities for that
Province only) Do I create a Fixed Data fields for both items, province
and city?

Just a single FixedDataDropdown should do the job nicely!

In this case, should my CSV file look like the following?
Prov1, City1
Prov1, City2
Prov2, City1
Prov2, City2
Prov3, City1
Prov4, City1

Looks perfect,

So, you now need to create your CCK field type, and when you are doing so, you'll see that there is a place to "upload" the CSV file, (as above). Then you need to make sure that the regular expression correctly extracts the province and city, and with luck, your done. I'd suggest trying a small file of a few entries first, get that working, then go for the big file.

Then the user should see a free text area where they start typing in the province, which will auto-complete - and then the city drop down will be filled in with the names of the city's in the province....

Cheers

Mark.

tumnus’s picture

StatusFileSize
new482 bytes

Thanks for the quick response.

After I created the field-type, I got the following error:

user warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON DUPLICATE KEY UPDATE fdd_key=VALUES(fdd_key)' at line 1 query: INSERT INTO fdd_field_farm_town_data (fdd_key, fdd_value) VALUES ("Abra","Bangued") ON DUPLICATE KEY UPDATE fdd_key=VALUES(fdd_key) in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.

Checking further, it appears that the csv file was not uploaded at all. I tried this several times but I'm having difficulty uploading the complete .csv file. Since I don't see any progress indicator, it's difficult to say if anything has been uploaded at all. This CSV file is a partial version containing only 27 records. I'm attaching it for reference.

I then tried to use the form I just created. Typing a province or a city doesn't produce anything on the dropdown.

I am wondering about the performance hits of the 1,500 town selector. I am thinking of doing several dependent dropdown fields Island group > Region > Province > Cities. Is it possible to create relationships between several dropdown fields?

PS
I appended ".txt" to the file otherwise I won't be able to attach it here. The original I tried to upload was just prov-town.csv.

markfoodyburton’s picture

Component: Documentation » Code
Assigned: Unassigned » markfoodyburton
Category: support » bug

Hi

The problem is clearly with this mysql error....
I took your data, and created a fdd myself. I didn't even change the RegExp from the default, and it worked perfectly.
So, this must be something to do with versions, I'm using php 5.x and mysql 5.x.

However, I have been a bad boy, and used the MYSQL syntax within a db_query, and used the ON DUPLICATE KEY UPDATE syntax, which, looking at it now might be a mysql extension. So - at a guess your using postfix, or mysqli or some such?

Anyway, the fix should be simple, but I'm not sure I will get to it today - please feel free to have a look yourself, or hopefully I'll get to it early this week sometime :-)

Cheers

Mark.

tumnus’s picture

i see. well, i'm using pretty older verions. PHP version is 4.4.1 and while MySQL version is 4.0.27-standard. my webhost is offering to upgrade me to a new physical server but i haven't gotten around to doing it.

so, what else can i do at the moment?

By the way, I thought I'd like the n-deep nesting request here: http://drupal.org/node/148803

Any chance it would see the light of day soon?

markfoodyburton’s picture

Ahh, very old versions, none the less, I thin my code should be cleaner, and it might help you. I'll work on it when I can.

For the other wish-list items, please get in touch using the contact form.

Cheers

Mark.

markfoodyburton’s picture

Status: Active » Fixed

Hi, I've fixed this issue, and the update is checked into the cvs. If you can confirm that it works for you, then I'll make a release

Cheers

Mark.

tumnus’s picture

Version: 5.x-1.2 » 5.x-1.x-dev

When you say it's in CVS, you mean to say I should download this version: FixedDataDropdown-5.x-1.x-dev.tar.gz?

Anyway, I did just that and I am still getting error messages:



    * user warning: Unknown table 'fdd_field_farm_province_data' query: DROP TABLE fdd_field_farm_province_data in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'San Luis' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="San Luis" WHERE fdd_key = "Batangas" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Valencia' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Valencia" WHERE fdd_key = "Bukidnon" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Tuburan' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Tuburan" WHERE fdd_key = "Cebu" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Samal' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Samal" WHERE fdd_key = "Davao del Norte" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santa Maria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santa Maria" WHERE fdd_key = "Davao del Sur" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santa Maria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santa Maria" WHERE fdd_key = "Ilocos Sur" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santa Maria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santa Maria" WHERE fdd_key = "Isabela" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santo Tomas' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santo Tomas" WHERE fdd_key = "La Union" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santa Maria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santa Maria" WHERE fdd_key = "Laguna" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Tudela' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Tudela" WHERE fdd_key = "Misamis Occidental" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Victoria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Victoria" WHERE fdd_key = "Northern Samar" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Victoria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Victoria" WHERE fdd_key = "Oriental Mindoro" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'San Luis' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="San Luis" WHERE fdd_key = "Pampanga" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santo Tomas' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santo Tomas" WHERE fdd_key = "Pampanga" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santa Maria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santa Maria" WHERE fdd_key = "Pangasinan" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santo Tomas' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santo Tomas" WHERE fdd_key = "Pangasinan" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Taytay' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Taytay" WHERE fdd_key = "Rizal" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Socorro' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Socorro" WHERE fdd_key = "Surigao del Norte" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Tubod' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Tubod" WHERE fdd_key = "Surigao del Norte" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Victoria' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Victoria" WHERE fdd_key = "Tarlac" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'Santa Cruz' for key 1 query: UPDATE fdd_field_farm_province_data SET fdd_value="Santa Cruz" WHERE fdd_key = "Zambales" in /home/zeus/public_html/kambing/includes/database.mysql.inc on line 172.

Trying out the field, I only get the last town of every province. (i.e. If there are 12 towns in a province, I only get the 12th one in the dropdown list).

Thanks for the help.

Anonymous’s picture

Status: Fixed » Closed (fixed)