Monday, July 26, 2010

iPad spell check thwarts sign-in attempts

Quick answer
In order to disable iPad's spell check the HTML form action must contain the word "login":

<form action="/login" ... >

For some websites the iPad does not try to spell check email addresses that are a part of sign-in forms. But for many websites, it does. It's annoying.

I often have my sign-in attempt thwarted because I didn't realize my email address was 'corrected'. And when I am aware that iPad is being smart, I have to wait to type a full word and then go up to click on the 'x' to dismiss the suggested correction. And because it's hit or miss on different websites, I am always tentative when signing in, which adds to the frustration.

So, I vowed when creating my new web app that I would ensure my sign-in forms worked in a way that did not invoke the spell-checker. However, my out-of-the-box Rails 3 and Devise web app was invoking the spell checker:

Bummer. What was the difference in the HTML between the websites that invoked the spell-check and the websites that did not? Here's what I found out:

I assumed that iPad was looking at the names of the input fields to determine if it should spell check. So, I looked at sites that invoke the spell checker, like:

Ta-da List:

and those that did not invoke the spell checker, like:


Ta-da List uses name="username" for the input text field while GitHub uses name="login". On the other hand, GMail uses name="Email" and Heroku use name="email". That must be it! It's doing a case-insensitive match for name="email".

But, no. After tweaking the HTML in my new app, it didn't work. I kept getting the spell checker in my form.

After trying many variations, I finally discovered the solution:

In order to get iPad to not invoke the spell checker on an email field while signing-in, the action on the form tag must contain the text "login". It can be capitalized or not. It can be surrounded by other text or not. But the form action must contain the characters "login".

form action=""

form action="/login"

I am using Ruby on Rails and Devise for authentication. So for my web app, I followed the directions here:

to change my form from using action="sign_in" to using action="login".

Now my sign-in form on the iPad behaves nicely with no spell checker:

Friday, July 23, 2010

Almost Switched to DataMapper from ActiveRecord

I was doing what seemed to be a straight-forward call with ActiveRecord from within the update method of a controller:

@project = current_person.projects.find(params[:id])

Well, when doing so I would get an error:

ActiveRecord::ReadOnlyRecord in ProjectsController#update

I was so frustrated by trying to workaround this issue that I spent the morning researching and playing with DataMapper with the intention of switching.

However, after feeling underwhelmed by the current state of DataMapper on Rails 3, I went back to finding a workaround. Luckily I found this comment at the bottom of a Pragmatic Bookshelf thread:


An other way is to disable readonly like so:

def index
@movies = Movie.find(:all, :readonly => false, :joins => :showings, :conditions =>
["showings.starts_on < ? AND showings.ends_on > ?",,])

That did the trick. Why :readonly => false it not the default, I do not understand.