Chapter 16.7. Anatomy of an Ajax Widget

Widgets are a part of the TurboGears view layer, so Ajax widgets need to work in cooperation with your application’s controller methods to get data back from the server. The AutoCompleteField widget defines a couple of important params which are used to control not only how the widget works, but also which controller method should be called when the user starts typing.

There are two major parts of the auto-complete widget: the first is widget code presented here, and the second is the autocomplete.js file which contains all the Java-Script necessary to make everything work.

In many ways the AutoCompleteField is just like any other widget; it defines a template, and a couple of params. The template sets ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.