Hi,
I am not accustomed to SQL queries and I am lost.
I have 3 fields related to the same thing: [society_name] [society_code1] [society_code2]. I created a “local_societies” table with this 3 values ‘society’, ‘code1’, ‘code2’ and 2 additional values for ‘region’ and ‘country’, in the Joomla database.
At Registration and Profile Edit, I would like to automatically fill up the 2 last fields when selecting the society name in a drop-down list.
I got inspiration from what is explained in the Query Field tutorial about “States/City/Zip” for trying to solve my problem.
Here is what I did:
For field [society name]:
- Field Type: Query Drop Down (Single Select)
- Query: SELECT DISTINCT `region`, `country`, `society` FROM `local_societies` ORDER BY `region`, `country`, `society`
- Options: Value Column = society // Label Column = society // Group Column = Country
- Update on = (nothing)
For field [society_code1]:
- Field Type: Query Drop Down (Single Select) … (don’t realy need a dropdown there because I have only one code1 per society)
- Query: SELECT DISTINCT `code1` FROM `local_societies` WHERE `society`=`[society_name]` ORDER BY `code1`
- Options: Value Column = code1 // Label Column = code1 // Group Column = (nothing)
- Update on = [society_name]
For field [society_code2]:
- Field Type: Query Drop Down (Single Select) … (don’t realy need a dropdown there because I have only one code2 per society)
- Query: SELECT `code2` FROM `local_societies` WHERE `code1`=`[ society_code1]` AND `society`=`[ society_name]` ORDER BY `code2`
- Options: Value Column = code2 // Label Column = code2 // Group Column = (nothing)
- Update on = [society_name] + [society_code1]
The first step is working : I get my first dropdown with societies sorts by region and country.
But, after selecting a society, nothing is displayed in the 2 other dropdown fields.
Any suggestion ?
Thanks for your help !