set combobox initial value selected based on id_key of selected record to edit

Hello, I created a form application of customers, this form has a field called region_id I tried to use a combobox control to show the list of regions using the automatic lookup property. It shows the list of regions, but I need this combobox to show the name of the region that corresponds to a customer when I edit the information of one customer.

For example, the customer Jorge Perez has region_id=5 that correspond to “Los Angeles”, but in the combo box always is selected the first region, I would like to view “Los Angeles” region selected when I choose that customer to edit, and it has to change depending on the region_id of the customer to edit.

How can I set the initial value selected based on the region_id of the customer?

Thanks for your help.

Re: set combobox initial value selected based on id_key of selected record to edit

You can do this for example by change the type of your field to ‘select’ in edition lookup set the SQL to list the region ,mark the ajax proccess to another field and load again the edition lookup.
check this link please: http://www.scriptcase.net/phpgenerator/baseknowledge/baseknowledge.php?id_topico=58

Re: set combobox initial value selected based on id_key of selected record to edit

Something like so:
http://www.scriptcase.net/systems/v5/exemplos_en_us/grid31/grid31.php

Regards,
Scott

Re: set combobox initial value selected based on id_key of selected record to edit

thanks, but those examples filters the list of the regions, I don’t want to filter the list, what I need is something different.

In an Edition Form (when I want to edit the information of one customer who already has a region_ID set) I am using a select field type for field region_ID so I need the combobox with the name of the region selected and with the possibility to change the region with any of the list in the combobox.

In short word:
I wan to see all the list of regions in combobox but the region of the customer selected in my edition form.

thanks for your help

Re: set combobox initial value selected based on id_key of selected record to edit

Hi did you manage to solve that i am facing the same problem.

Help appreciated

Thanks

Re: set combobox initial value selected based on id_key of selected record to edit

i think i can help… first, you have to create a new field, maybe region_old. This field will be update OnRecord event with the region description that comes with your current record.
Then you can select from combo box any region and update the field region_old with the OnChange field event over your select field.