Ajax on Scriptcase’s forms may be used to reload a select type field based in the value of another select type of field. It will filter one select field showing only the cities from a state selected in a previous select type of field.

CHECK the example running at THIS LINK

 

Select field using Ajax to reload select field

This example covers the development of a search application using the Ajax field reload.

Creating a new grid

1. Create a new grid application using the SQL Select Statement as below:

SELECT
E.EmployeeID, E.LastName, E.FirstName, E.Title, E.TitleOfCourtesy, E.BirthDate, E.HireDate,
E.Address, E.PostalCode, E.Country, E.CityID, E.RegionID, E.HomePhone, E.Extension, E.Photo,
E.Notes, E.ReportsTo, E.PhotoPath, U.EmployeeID, U.TerritoryID
FROM
employees E INNER JOIN employeeterritories U ON E.EmployeeID = U.EmployeeID
INNER JOIN territories T ON U.TerritoryID = T.TerritoryID

 

2. Select the Fields Positioning option in the application menu and choose U.EmployeeID, E.LastName, E.FirstName, E.Title, E.BirthDate, E.HireDate, E.RegionID, U.TerritoryID and E.Country fields.

Starting Grid application by Search

3. Open Grid folder and click in Grid Modules.

4. Set the Search as the initial module.

Choosing Search fields

5. Open the Search folder and click in Advanced Search >> Select Fields.

6. Choose E.RegionID and U.TerritoryID fields.

Search Fields Settings

7. Open U.TerritoryID field, in search fields.

8. Change Data Type attribute to Select.

9. Open the Search Lookup block and configure the settings according to the image below.

SQL
select territoryid, territorydescription
from territories
where regionid = {e.regionid} and
territoryid in (select distinct territoryid from employeeterritories)
order by territoryid

 

10. Open E.RegionID settings, modify the Data Type attribute to Select configure it as following .

SQL
select regionid, regiondescription
from region
where regionid in (select distinct regionid from employees)
order by regionid

 

Enabling Ajax to reload the field

11. Open the Ajax Processing block and mark the option “Use AJAX to reload…“.

12. Click “Run application”

 

Click the button below to view the application running.

 

 

Do you want to see more Scriptcase samples? Click HERE to visit our samples page.

You might also like…

Do they pay for your system or code?

For all those who develop system and softwares every day at work: Have you ever wondered what makes...

What is Business Intelligence anyways?

Surely you have listened about the expression, “BI” or “Business Intelligence”, the questio...

Scriptcase & Web Services

This time I will explain how to work with web services inside the Scriptcase, directly with PHP and...

You might also like…

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.