0

I have a simple login which starts off with a disabled login button unless the username and password are filled (this check is done by jQuery and removes the disabled attribute if filled).

The problem I am now having is checking to see if the fields are pre-filled by an existing cookie, if they are, then the pre-emptive disabled attribute should not be applied. I was thinking of doing this through Rails but perhaps it can also be done via Javascript / jQuery.

So the question in short could be: how do I check for a cookie in Rails 3.2.* or jQuery?

Hubert Kario
  • 21,314
  • 3
  • 24
  • 44
Jonathan
  • 10,936
  • 8
  • 64
  • 79
  • This may help you http://stackoverflow.com/questions/1232174/rails-cookies-set-start-date-and-expire-date – scumah Mar 12 '12 at 20:07

1 Answers1

3

In the controller you can just say cookies["key"] to get the value of something stored in a cookie.

Ibrahim Muhammad
  • 2,808
  • 4
  • 29
  • 39
  • This can also be done using jQuery through a plugin: http://stackoverflow.com/questions/1599287/create-read-and-erase-cookies-with-jquery – Ibrahim Muhammad Mar 12 '12 at 21:49