COMPANY
COMMUNITY
BLOG
HELP
MY ACCOUNT
EN PT ES

Imagen6940E

Automatic Inclusion of Ajax Based Code

(24/01/2006-00:00)
Following with the line of Ajax based features introduced by GeneXus 9.0, we will present how to implement "Dynamic combo boxes with filters" in a practical case.

In the previous edition of GeneXus News, we saw two properties that can be configured to simplify data entry and help design more attractive and friendly interfaces with the automatic inclusion of Ajax based code: InputType and Suggest. In this edition well see an example of the use of other Ajax based properties introduced by GeneXus 9.0: Filters with dynamic combos.

Lets see a simple example such as Countries & Cities. The main idea is that in a form (such as the forms used to create a mail box) the user must enter the Country and the City where he lives. To facilitate the entry of the information, both the Country and the City fields are presented as a combo. Once the Country has been selected, the city combo is then expected to be automatically loaded with the cities of the Country that was selected.

Now that we have explained the problem we will have then:

Country transaction with the following structure:

City transaction :

On the other hand we have a Customers transaction where the various customers will be added. Among the information to be filled out there is the Country and the City where the customer lives.

 

In any conventional programming language, creating a form where the City combo loads automatically from the selected Country and without refreshing the whole page would mean great programming efforts in javascript and obviously logic on the server side. However, solving this problem in GeneXus 9.0 has a nil cost by using Ajax based code generation. Development time is thus substantially reduced and productivity is increased.

The steps to be followed are:

1- Define CountryId , CityId and Dynamic Combo Boxes

2- Run the application and enjoy.

When selecting a country, the country cities will be displayed as shown in the previous image, without refreshing the whole page (as was mentioned before). It is well known that a short time ago, loading dependent combos always implied a total refresh, reducing usability and generating uncertainty in the client. All these limitations of the traditional web model (where server postbacks always had to be forced by the user) are now outshined by the features of Ajax based GeneXus (where server postbacks can be done now by the same application asynchronically)

With this we end the series of news explaining the various Ajax based features. We invite you to try out these features at http://www.gxajax.com/sample/

 

Learn everything about GeneXus and Ajax:

http://www.gxajax.com

Related
GXplorer, GeneXus.Net, Ajax, and Intelligent Cards
GeneXus 9.0 and Ajax
Getting Started with GeneXus 9.0 & Ajax