I want to convert username and password fields that I’m using in my auth component to upper case, before the login action. I tried to set
text-transform:uppercase;
in my CSS, for inputs, and it worked. But the uppercased information do not go to the database. The strings will only be uppercased if I write them with capslock. Could someone give me an example (for newbies)?
Thanks!
EDIT:
Here is my login action:
function login() {
if (!empty($this->data) && $this->Auth->user()) {
$this->User->id = $this->Auth->user('id');
$this->User->saveField('last_login', date('Y-m-d H:i:s'));
$this->redirect($this->Auth->redirect());
}
}
you can uppercase in server-side php as demonstrated by @thecodeparadox, or you can do so with client-side javascript or if you’re using jQuery, add it to your events.
html/javascript:
demo: http://jsfiddle.net/85HEy/2/
or html/jQuery:
demo: http://jsfiddle.net/T9XbP/