alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

A helper should not use 'onclick' #143

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

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

alfonsodg commented 10 years ago

From massimo....@gmail.com on January 10, 2011 10:11:47

I think we should discuss on web2py-developers, please join us there. The reason I am not convinced is that the Githubissues.

  • Githubissues is a development platform for aggregating issues.