Currently, the 'A' helper, when passed a 'cid', uses the 'onclick'
attribute to override the default behaviour of the anchor tag when
clicked, and use AJAX.
I don't think this is the best: I consider the 'onclick' attribute
harmful for it doesn't allow for easy manipulation, and since web2py
uses heavily the jQuery library, I think that the correct way to add
this AJAX behaviour is to add a script tag afterwards that uses the
click(callback) method of jQuery to achieve the same goal. This way,
it's cleaner and the programmer can override or add further logic to
the link.
From eord...@gmail.com on January 04, 2011 12:14:54
Currently, the 'A' helper, when passed a 'cid', uses the 'onclick' attribute to override the default behaviour of the anchor tag when clicked, and use AJAX.
I don't think this is the best: I consider the 'onclick' attribute harmful for it doesn't allow for easy manipulation, and since web2py uses heavily the jQuery library, I think that the correct way to add this AJAX behaviour is to add a script tag afterwards that uses the click(callback) method of jQuery to achieve the same goal. This way, it's cleaner and the programmer can override or add further logic to the link.
PFA a patch with this recomendation.
Attachment: ajax_event.patch
Original issue: http://code.google.com/p/web2py/issues/detail?id=145