Disabling the Javascript in Drupal Comment Forms

In Drupal, forms have nice little features which slide up and down some areas and make textareas resizable. The example is in the search page, where the “advanced search” field slides down when you click on it. It is a nice feature, especially in administration pages where forms tend to get very long. And it is tightly integrated to Drupal so you don’t need to waste some precious time implementing it.

The reason I am saying this is because those effects require Javascript (and more specifically, the JQuery library), which itself weights around 19 KB, and Drupal’s own Javascript flavor, drupal.js which is around 5 KB. 24 KB is admittedly small for that kind of effect, but surely you won’t want to double your page size just for it, will you? And don’t mention the extra HTTP requests and additional script for each effects…

Now suppose that you are a blogger who dreads for comments very much that you make the process of submitting comments as easy as possible. You will put the comment form right under the content, in the same page. Suddenly all your content pages need Javascript for it to function, just because of that tiny little form which only a bit of your site visitors care!

Fortunately enough, there is a way to remove this functionality which in turn removes the need of Javascript for a particular page. Behold Comment Form, my own tiny little Drupal module! (download link below) After downloading, installing, and enabling this module, you can go to comments admin page, and there’ll be a new tab, ‘Comment form display’. There, you can disable and enable those Javscript-hungry effects as you wish. As a bonus, you can configure how many rows the comment form textarea will have (because I really think it is too high).

My investigation concludes that by using this module properly, you can reduce the total size of one page by 28 KB.

I hope that this module helps bloggers using Drupal a bit. And the reason I’m not putting this in drupal.org is that it is so lightweight (the code is just 2.5 KB) that I don’t want to bother setting up CVS, maintaining it, etc. If someone wants to take care of it I would be glad, just drop me a line here (it is GPL, by the way).

AttachmentSize
comment_form.tar.gz6.61 KB

Do you have a module for

Do you have a module for disabling javascript in comments form for drupal 6?

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <pre>
  • Lines and paragraphs break automatically.