This page shows the workflow of a form across multiple page requests, including AJAX requests and form rebuilds. This applies to both Drupal 6.x and 7.x.
Form without AJAX
Let's start with a form without any
Once the user has gone through these two page loads, the form is cached. Thus any further form rebuilds now work like this:
Form with AJAX
When a form includes some
For Drupal 6 this might look a bit different, as the AHAH callback has to implement all the form magic on its own; the details of this vary depending on the callback. But usually, the form is retrieved from cache, processed, and then a new form is prepared, cached and rendered -- which is pretty much the same as in Drupal 7.
Any further page loads are now served from cache, regardless of whether the AJAX callback is triggered in between or not: