Ajax on Scriptcase’s forms may be used to reload a select type field based in a 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…

Deep Data and Scriptcase: Revealing what goes on in a Business

Deep learning can give rise to something called Deep Data. Useful ways you can utilize Scriptcase to...

Tips on facilitators for developers – Part II

Hello! On the latest post i’ve shown some hints on facilitators for developers. On today’s post ...

Tips on facilitators for developers – Part I

Check out some options within Scriptcase that will work as facilitators that developers can use befo...

Comment this post

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