You can do it using Javascript ... like this:
<script type="text/javascript" language="Javascript">
function capitalize(campoFormulario) {
var string = document.getElementById(campoFormulario).value;
if(string.length > 0) {
string = string.toLowerCase();
string = string.split(' ');
for (var i = 0, len = string.length; i < len; i++) {
if(string[i].length > 2) {
string[i] = string[i].charAt(0).toUpperCase() + string[i].slice(1);
};
};
document.getElementById(campoFormulario).value = string.join(' ');
return true;
}
}
</script>
In html, in the field Input identified with the id, it will look like this:
<input type="text" name="campo_nome" id="campo_id" onkeyup="capitalize(this.id);">
One single remark: When I put in the javascritp code "if (string [i] .length> 2)" I am indicating that I want to capitalize only words that have more than 2 characters ... if you prefer, , or delete that if.