/ Published in: JavaScript
                    
                                        Controllo sui caratteri nelle textboxes in Javascripts
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 //FUNZIONE CHE CONTROLLA i caratteri ammessi in una textbox function Check_char(ct){ f=document.forms[0]; el=f.elements; el[ct].value = trim(el[ct].value); reg_ex = /^([a-zà èéìòù]+['\s]?){1,}[a-zà èéìòù]$/ig stringa = el[ct].value; if( stringa.match(reg_ex)) return true; else { alert("Attenzione!\nCarattere non ammesso nel campo "+ct+"\n\nSono consentiti solo lettere, spazi e apostrofi. Non sono ammessi:\n - numeri\n - caratteri speciali (es ?,@,_,*,+,-,/)\n - spazi prima e dopo gli apostrofi\n - doppio spazio o doppio apostrofo\n - apostrofo finale\n - spazi iniziali e finali"); el[ct].focus(); return false; } }
Comments
                    Subscribe to comments
                
                