Solved

Restricting Turkish Characters in Forms

Posted on 2006-11-07
2
405 Views
Last Modified: 2010-05-18
I have my Javascript to retrict special characters & Turkish characters.  When I save my file using Dreamweaver the Ğğ become Gg and the Şş become Ss which then sees the normal letters like GgSs as special characters.  How do I restrict the Turkish characters from my form?

var etcVal   = ' ~`!@#$%%^&*()-_=+\|[{]};:\'\",<.>/?&#286;&#287;Üü&#350;&#351;Çç';

function Specialcheck(value) {    
   var blankCount=0;
   var Speccount=0;
         
   for ( var i = 0 ; i < value.length ; i++ ){
      if ( value.substring( i, i+1 ) == " "  ) {        
         blankCount = blankCount + 1;  
         
      }
         for(j=0;j<etcVal.length;j++){
           if(value.substring( i, i+1 )  == etcVal.charAt(j)) {
               Speccount = Speccount + 1;
           }            
          }
   }    
   
      if(blankCount > 0 || Speccount > 0){
         return true;        
      }else{
         return false;    
      }
}

Thanks.
0
Comment
Question by:scgproductions
2 Comments
 
LVL 30

Accepted Solution

by:
callrs earned 500 total points
ID: 17892862
http://www.kadifeli.com/fedon/utf.htm  Unicode Characters and HTML Numeric Character References

Try 4-digit hexidecimal unicode values, as in this demo:

<script type="text/javascript">
var etcVal   = ' ~`!@#$%%^&*()-_=+\|[{]};:\'\",<.>/?\u011e\u011fÜü\u015f\u0160Çç';
document.write(etcVal+"<Br>");
function Specialcheck(value) {    
   var blankCount=0;
   var Speccount=0;
         
   for ( var i = 0 ; i < value.length ; i++ ){
      if ( value.substring( i, i+1 ) == " "  ) {        
         blankCount = blankCount + 1;  
         
      }
         for(j=0;j<etcVal.length;j++){
           if(value.substring( i, i+1 )  == etcVal.charAt(j)) {
               Speccount = Speccount + 1;
           }            
          }
   }    
   
      if(blankCount > 0 || Speccount > 0){
         return true;        
      }else{
         return false;    
      }
}

document.write("GgSs: "+Specialcheck("GgSs")+"<br>")
</script>
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question