3 Replies Latest reply on Jun 6, 2008 12:28 PM by smgilson

    Validator question

    xrum Level 2
      hi,

      i have a combo box, that depending on the selection it hides and unhides certain fields. when they are visible, i need to validate them, if not - no need to worry.

      How to i tell the validator to only validate when they are visible?

      Thanks!
        • 1. Re: Validator question
          smgilson
          Could you bind the component's visible property to Validator.enabled?

          <mx:Text id="myText"/>

          <mx:StringValidator enabled="{myText.visible}"/>

          Stephen
          • 2. Re: Validator question
            xrum Level 2
            oh, i didn't realize i could do that. I acutally already found a way to do it, if a whole bunch of if statments :) mhehe, but it works. i'lll try to do it your way :)


            another question. It seems that in my functions if i reference a field which is located on a different tab, it does not recoglize it, and i get a runtime error, unless i click on that tab, before clicking on the "validate" button.

            does anyone know why it's not recognizing it? do i need to somehow declare that field in my init()?

            Thanks!
            • 3. Re: Validator question
              smgilson Level 1
              Accordions and TabNavigator use deferred instantiation, where they do not create the tab until the user first goes to it. If you want to access data in a tab before the user first goes to it, set creationPolicy to all so that it creates all the tabs at startup. The penalty is longer startup time.

              Search the doc for creationPolicy for more information.

              Stephen