[development] book.js bug, and lack of documentation for the new ahah feature. Re: groking ajax callbacks

Augustin (Beginner) drupal.beginner at wechange.org
Wed Jan 2 12:05:07 UTC 2008

On Friday 28 December 2007 06:46, Earl Miles wrote:
> Augustin (Beginner) wrote:
> >     url: Drupal.settings.book.formCallback +'/'+ $('#'+
> > Drupal.settings.book.formId +' input[name=form_build_id]').val()
> > +'/'+ $('#edit-book-bid').val(),
> The part that you're not seeing is that there are 'settings' that
> are set via inline javascript and there's a Drupal-side API to make
> this easy:
> drupal_add_js($some_array, 'setting');
> So if: $some_array = array('book' => array('formCallback' =>
> 'book/js'));
> That covers the first part of it.

Actually, no. 
It's nice that I learned the construction drupal_add_js($some_array, 
'setting'); which I didn't know before.
But book.module doesn't use the setting function.
Its only call of drupal_add_js is to add some inline js. 

I knew there was something wrong with that module. I grep'ed 
everywhere, and searched the jquery docs, but there is no 
formCallback entity defined anywhere... though there WAS one.

I spent 12 hours trying to understand book.js... just to figure out at 
the end that book.js is NOT actually used anymore. It's still part of 
a core D6 install only because, as I just found out, a patch was not 
fully applied.

book.js is no longer required. The job is done by FAPI and the new 
ahah functionality (which is still not documented anywhere), as I 
mentioned in the other email in this thread.

> The it pulls the formId out of the settings and uses jQuery to find
> the form_build_id input in that form and take it's value, and after
> that you've got the book id from #edit-book-bid.
> Search book.module for drupal_add_js and look for the 'setting'
> call. I think it'll be more clear after that.

Now that book.js is out of the picture, do I become clearer...




More information about the development mailing list