Google Chrome Autocomplete Bug

Web developers… here’s a bug you might encounter when doing html forms.

If you are testing your forms and you use Google Chrome’s “autocomplete” feature, all radio buttons and checkboxes are cleared! (For example, if you use “autocomplete” to fill in a text box, any radio buttons or checkboxes that you set earlier are now unset). The effect is that when you hit the Submit button, your processing script (say, a php file) doesn’t get the inputs it is looking for.

This has been seen in chrome version 27.0.1453.110 m. Also: 27.0.1453.93.

A bug report has been filed.

Current Workaround

Best thing to do is to add autocomplete=”off” to all radio and checkbox fields when you are setting up your input form.

For example:

<input name=”radio” type=”radio” id=”something” value=”whatever” autocomplete=”off”/>

Hopefully you haven’t spent too much time, pulling your hair out wondering why your _POST or _GET variable isn’t showing up when processing form inputs (like I did).

– Bill

Posted in Blog

Fixing Clean URLs in Drupal 7

I am in the middle of installing Drupal 7 on a server at my workplace. I ran into a curious problem with Drupal Clean URLs – namely, I couldn’t get them working. Here’s my breakdown of the problem and how I resolved it.

Troubleshoot: Drupal Clean URLS (Drupal 7)

Problem:

Home » Administration » Configuration » Search and metadata » Clean URLs

There is an option to run the Clean URL test. The test should either come back with a 404 error, or the page saying that the test was successful and you can now set your option checkbox. Unfortunately, when clicking the button all the page did was reload. No other messages were seen.

Solution:

Obviously, if the server can’t support clean URLs then I should at least get a 404. A better result would be an error message giving me hints. (This bug has been confirmed in Drupal 7 and the fix is still in process).

The way I fixed it was following these steps on my Apache Server (Ubuntu 10):

(Note: I am assuming here that you are running a dedicated server and have access to the Apache process. If not, contact your system administrator)

1. Make sure the rewrite module is enabled by going to /etc/apache2/mods-enabled. If “rewrite.load” is not there you will have to add it:

$ sudo a2enmod rewrite

2. Add this code to /etc/apache2/httpd.conf:

# fix for clean urls
<Directory /var/www/yoursite>
AllowOverride all
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

Then save the file.

Note: if your site is located in a spot other than “/var/www/yoursite” you’ll have to use that path instead.

Note: if your site isn’t located at the root, you should include the directory name. For example, if your site is accessed on the web as “http://yoursite.com/blog/” then you’ll probably need to write in the path “/var/www/yoursite/blog”. If you do this, you’ll also need to change the line that says “RewriteBase” to: “RewriteBase /blog/”

So, in this case, your addition to httpd.conf will look like this:

# fix for clean urls
<Directory /var/www/yoursite/blog>
AllowOverride all
RewriteEngine on
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

3. Restart Apache

$ sudo /etc/init.d/apache2 restart

4. Finally, rerun your Clean URL test. You should now see a checkbox for enabling URLs. (You may have to clear your Drupal cache and Browser cache before running the test).

-Bill

Posted in Blog