Solved

Restricting Turkish Characters in Forms

Posted on 2006-11-07
2
408 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Simple Linear Regression

734 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