Hello Everyone,
I'm just getting started in Drupal, and have a basic knowledge of php though by no means a professional programmer. What I'm trying to do is the following:
My website is mainly for users in Spain, and I want to add a physical address to the fields the user must supply when registering. (I know how to use the profile module to add the fields.) I have a database of Spanish postal code and town pairings comprised. In Spain, it is possible for more than one town to share the same postal code. What I want is to automatically populate the town field based on the zipcode entered. If the zipcode corresponds to only one town, show that town name. If it corresponds to more than one town, show a drop down with just the related town names.
I imagine the simple way to ensure proper town data would be simply to add a validation that checks the postal code / town pair when the new user hits the save button, and if the check fails return the allowable town names in the error message. The problem with this is that many towns have official names that are long, and many people will enter shortened versions, which will cause the validate to fail, followed by the hastle of having to type the town name EXACTLY as it is shown in the error message.
So what I'd really like is a two-part registration process. Perhaps an initial screen with just the town and country (if the country isn't spain, disable the validation), followed by the main screen where I create either the text field or drop-down for the town name based on the value of the postal code previously entered. Later, when an already registered user wants to edit his address, I could place a button next to the postal code and country which they would have to press to change either of these two fields. The button would bring them back to the country/zipcode page, and upon returning to the main edit form the town field would be updated accordingly.