I am working on eclipse java using swt jface with rcp. How can i limit the characters in my text box. Like if i want only 4 characters in my text box then what should i do? and what if i want alphanumeric combination . again in certain limit?
                +1 
                A: 
                
                
              Please look this function example for limit the character
function check_length_year(my_form) {
  maxLen = 4; // max number of characters allowed
  if (my_form.retire_year.value.length > maxLen) {
  // Alert message if maximum limit is reached.
  // If required Alert can be removed.
  // var msg = "You have reached your maximum limit of characters allowed";
  // alert(msg);
  // Reached the Maximum length so trim the textarea
     my_form.retire_year.value = my_form.retire_year.value.substring(0, maxLen);
     return false;
  } else { // Maximum length not reached so update the value of my_text counter
     my_form.year_num.value = maxLen - my_form.retire_year.value.length;}
  } 
                  Karthik
                   2010-04-20 05:09:43
                
              Is that Javascript?
                  Nitrodist
                   2010-04-20 06:26:29
                Yes javascript only
                  Karthik
                   2010-04-20 06:37:45
                I m nt using javascript.should this be done as a validator to text box? if yes ,,,,,,how?
                  sam
                   2010-04-20 06:46:35
                not getting your point. Explain your need in detail
                  Karthik
                   2010-04-20 07:51:31
                I am using eclipse RCP.In my editor i have a text box.I want to set a limit on the text entered in the text box so that whenever user tries to enter a text more than 8 characters.it should not accept it.
                  sam
                   2010-04-20 10:19:40
                for this one, you have to use js only.
                  Karthik
                   2010-04-20 11:57:46
                check this url :http://www.mediacollege.com/internet/javascript/form/limit-characters.html
                  Karthik
                   2010-04-20 13:47:25