You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

The ajax theme extends the xhtml theme, providing AJAX features on top of everything provided by its parent theme. This theme uses two popular AJAX/JavaScript libraries: Dojo and DWR. These AJAX features are:

  • AJAX Client Side Validation
  • Remote form submission support (works with the submit tag as well)
  • An advanced div template that provides dynamic reloading of partial HTML
  • An advanced a template that provides the ability to load and evaluate JavaScript remotely
  • An AJAX-only tabbedPanel implementation
  • A rich pub-sub event model

Lessons Learned

IS THIS NEEDED ANYMORE?

Dojo is particular about the onload event.
This thread details the whole thing
But if you want the cliff notes... Dont do this:
window.onload= function(){ . . . }

This was preventing dojo from parsing the widgets, since dojo
hooks into window.onload in dojo.js, which you just
overwrote

You should use this :
<script language="JavaScript" type="text/javascript">
dojo.event.connect (window, "onload" , function() {
...
});

Extending the XHTML Theme

The wrapping behavior provided by this theme is almost exactly like that provided by the xhtml theme. The only difference is that the controlheader.ftl template is slightly different:

Error formatting macro: snippet: java.lang.NullPointerException

This provides for AJAX Client Side Validation by checking if the validate attribute is set to true. If it is, on each onblur event for HTML Tags, a validation request is made. Some people don't like the onblur behavior and would rather a more advanced timer (say, 200ms) be kicked off after every keystroke. You can override this template and provide that type of behavior if you would like.

Special Notes

While most of the templates in this theme are self explanatory, there are some templates that should be called out and explained in detail:

Especially with this theme, it is strongly recommended you use the head tag. See the ajax head template for more information. Without it, you most likely not have AJAX support set up properly.

In addition to these templates, it is important to make yourself familiar with the ajax event system provided by WebWork and Dojo.

  • No labels