In this topic we will use our Ajax, with two fields type select,(combobox).
One field will list categories of the products and the others the product it self.
Table Categories
Id |
Categories |
1 |
Condiments |
2 |
Seafood |
3 |
Grains/Cereals |
4 |
Beverages |
Table Products
Id | CategoryId |
Product |
1 | 1 |
Outback Lager |
2 | 2 |
Boston Crab Meat |
In an form, we will use Ajax to perform that task, first we need to enable Ajax in the application, the menu Configuration->Ajax Use = yes. Click in the field categories and change the data type to select(combobox), go to section Edition Lookup and change the lookup method to Automatic with this SQL:
Fields of the Categories
select Id, Categories from categories
This SQL statement will show the name of the categorie and will sabe the id.
In the field product, change the data type to select(combobox), go to section Edition Lookup and change the lookup method to Automatic with this SQL:
select product from products where CategoryId = "{categorie}"
{categorie} -> is the field that will show the select field(combobox) with the result of the SQL: select Id, Categories from categories.
After this, click on the field categories, go to the section Ajax Processing and check the option "Use AJAX to reload other fields of type Select, Double select, Radio and Checkbox. " ... them doubleclick on the field product to check it to reload.
After this, execute the application.
Amanda Santos (Migrated deleted Agent)
Comments
Ronyan Alves
Staff –
Ronyan Alves
Staff –
gamo nana
PT Viardi Bintang Terang