Page 1 of 1

a sort of dependent drop down...?

Posted: 2011-11-21 18:16
by antonio
Hi all,
I have a custom transaction on a page that is driving me crazy.

I have a dropdown menu(1) that allow you to select a record from a table (mysql).
Then I have 5 additional fields that get populated once I select something from the main drop-down menu(1). I used multi-field drop-down to do this. This is working ok.
All multi-field fields are input fields.
What if I need to use a 'select' field (menu2)?

When the user select something from menu(1), this second menu(2) should change to reflect the data inserted in the db for the record pointed from menu(1).
Example:

Table 1
- id_tab1 (int3)
- name_tab1 (varchar 255)
- country (int 3)

Table 2
- id_country (int 3)
- name_country (varchar 255)

The first drop-down menu will show only the Table1 name field.
I would like to add a second drop-down menu (country) that should automatically select the country set in Table1 when changing something in the first menu(1) (something similar to dependent drop-down menu).
The user should have the choice to retain the selected country or change it to something else (choosing from the country drop-down menu).

But I cannot get it.
I can't add a foreign key to table 2 since it has not a relation one2one.

Is there someone that can help me?

TIA very much.

tony