2 Replies Latest reply on May 17, 2006 12:25 PM by smash

    Character restrict not working

    smash
      Hi, I'm trying to restrict the characters in my input text field to digits only (0-9) -- it's an age restriction. But for some reason it's not working. Here is my code:

      var age = "";

      ageRestrict = function () {
      age.restrict = "0-9";
      };
      ageRestrict();

      Also, if I don't use var age = ""; it will say undefined when I publisht he movie. Why is that?

      What am i doing wrong?

      Thanks

      A Text
        • 1. Re: Character restrict not working
          Level 7
          If you read the Flash help about the restrict property, it's a property
          of a TextField -- i.e. not of a variable and not of the textfield's
          "variable" property.

          What is the instance name of your input textfield? The restriction
          should be as simple as:

          myInputTFInstanceName.restrict = "0-9"

          smash wrote:
          > Hi, I'm trying to restrict the characters in my input text field to digits only
          > (0-9) -- it's an age restriction. But for some reason it's not working. Here is
          > my code:
          >
          > var age = "";
          >
          > ageRestrict = function () {
          > age.restrict = "0-9";
          > };
          > ageRestrict();
          >
          > Also, if I don't use var age = ""; it will say undefined when I publisht he
          > movie. Why is that?
          >
          > What am i doing wrong?
          >
          > Thanks
          • 2. Re: Character restrict not working
            smash Level 1
            Oh I see! You're right. I was using the variable name instead of the instance name.. Now it works.
            thanks!