Showing Database values in a form by selecting ComboBox value

Hello Guys,
I have a table with the name,address,city,phone and mail of clients. I want to make a form application which first field will be an ajax auto complete field with tha name of the client and when i choose him to show me all the other data as address, city,phone etc to the next fields. I did it with sc_concat in one field but it is a very big row with data, so it is better to be different fields. I read some posts and saw that it is better choice to use select field for the name and using ajax to reload but it didn’t works. What am i doing wrong? May i have your help?

Thank you very much!

Create a new field (customer_choice) with data type “select”. In the general settings of that field use a variable name (e.g. [var_customerid]). Create a lookup for that field. You can now select your adress/customer.

Now create a Ajax event field customer_choice, type onChange with this code:


// [var_customerid] = your (global) variable in general settings
// {customer_choice} = your (select) field

[var_customerid] = {customer_choice};

// restart your form after customer select
sc_redir(form_customers.php);    

At form settings / sql you must have a where-condition like:


// customerid = key field in your table
// [var_customerid] = your (global) variable in general settings

customerid = '[var_customerid]'

That’s all … :slight_smile:

Hmm… It is not clear form me. How to create button after field Customer e.g. “[Choose Customer]”, that open search for this Customer and “[Select]” one, and propagate all “Customer” information like City, Address, Phone etc to the form ?

I think you want to use a link (check the menu on the left under Links). RHS already described it fully.