Current

This document is valid for the current version of Plone.

AJAX & Errors

by Plone Documentation Team last modified Feb 26, 2011 09:13 PM
Contributors: Mikko Ohtamma, Martin Aspeli, Kamon Ayeva, Israel Saeta Pérez

AJAX work inevitably introduces error-handling problems. The recommended solution for this class of problems is to reverse the progressive-enhancement process. Since AJAX functionality should be an enhancing supplement, it should nearly always be possible to solve AJAX error problems by falling back on un-enhanced behavior. Note that the un-enhanced behavior may well be an error page.
This is more an error-handling philosophy than a recipe, and may in particular not be applicable in a multi-step process.

An example: it's common to use AJAX in forms to validate on a field-by-field basis. However, all such forms should also be handling form errors without JavaScript by returning error messages after feedback. Rather than introducing complex error-handling for AJAX failures during live form validation, it's simpler and more robust to fall back to server validation of the entire form.