Não sei se já foi discutido aqui no forum, procurei e não localizei.
Gostaria de saber como obrigar o usuário a digitar somente em caixa alta em todo o formulário.
Autor: alessandro santos
Não sei se já foi discutido aqui no forum, procurei e não localizei.
Gostaria de saber como obrigar o usuário a digitar somente em caixa alta em todo o formulário.
Autor: alessandro santos
99 comentários
{
jQuery("input" ).each( function()
{
var type = this.type;
if (type == 'text' || type == 'password' || tag == 'textarea')
{
jQuery(this).keyup(function() {
this.value = this.value.toUpperCase();
});
jQuery(this).change(function() {
this.value = this.value.toUpperCase();
});
}
});
}
Abraço.
{
var type = this.type;
if (type == 'text')
{
jQuery(this).keyup(function() {
this.value = this.value.toUpperCase();
});
jQuery(this).change(function() {
this.value = this.value.toUpperCase();
});
}
{
jQuery(this).keyup(function() {
this.value = retira_acentos(this.value);
this.value = this.value.toUpperCase();
});
jQuery(this).change(function() {
this.value = retira_acentos(this.value);
this.value = this.value.toUpperCase();
});
} E nos meus scripts tenho a função function retira_acentos(palavra) {
var com_acento = 'áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ';
var sem_acento = 'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC';
var nova='';
for(i=0;i<palavra.length;i++) {
if (com_acento.search(palavra.substr(i,1))>=0) {
nova+=sem_acento.substr(com_acento.search(palavra.substr(i,1)),1);
}
else {
nova+=palavra.substr(i,1);
}
}
return nova;
}
{
$acentos = array(
'A' => '/À|Á|Â|Ã|Ä|Å/',
'a' => '/à|á|â|ã|ä|å/',
'C' => '/Ç/',
'c' => '/ç/',
'E' => '/È|É|Ê|Ë/',
'e' => '/è|é|ê|ë/',
'I' => '/Ì|Í|Î|Ï/',
'i' => '/ì|í|î|ï/',
'N' => '/Ñ/',
'n' => '/ñ/',
'O' => '/Ò|Ó|Ô|Õ|Ö/',
'o' => '/ò|ó|ô|õ|ö/',
'U' => '/Ù|Ú|Û|Ü/',
'u' => '/ù|ú|û|ü/',
'Y' => '/Ý/',
'y' => '/ý|ÿ/',
'a.' => '/ª/',
'o.' => '/º/');
return preg_replace($acentos,
array_keys($acentos),
htmlentities($str,ENT_NOQUOTES, $enc));
} A chamada da função é feita no inicio do arquivo VO da pasta DAO ela é executada somente ao gravar os dados no banco de dados include('lib\funcao.php'); e chamado na função set function setNome( $strNewValue = null )
{
$strNewValue = remover($strNewValue);
$this->nome = strtoupper($strNewValue);
} Com isso resolvi o meu problema.