Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Validate a edit text field

$
0
0

Hi

 

I have created a simple panel with a username and password as statictext and a pair of edit text and a go button to work as a "enter' button for the edit text.

So what I am trying to achieve, is having a "if/else" statement validate the text.

 

so i created 2 variables, one for username and one for password.

 

Exsample:

 

var userName = "Test1234"

 

As you see here below, you can see the group structure of the text, edit txt and button.

 

  groupOne: Group{orientation:'column' , alignment:['fill','fill'], alignChildren:['fill','fill'],\

            myStaticTxt: StaticText {text: 'Username:'},\

            myStaticTxt2: StaticText {text: 'Password:'},\

            },\

            groupTwo: Group{orientation:'column' , alignment:['fill','fill'], alignChildren:['fill','fill'],\

            myEditTxt: EditText {text: ''},\

            myEditTxt2: EditText {text: ''},\

            },\

            groupThree: Group{orientation:'column' , alignment:['fill','fill'], alignChildren:['fill','fill'],\

            mygoBTN: Button {text: 'Go'},\

 

 

When the user has written a text in the edit text field for username, I want to validate it like below.

 

 

var goBTN = myPanel.grp.groupThree.mygoBTN;

   

    goBTN.onClick = function(){

   

        if(myEditTxt == "Test1234"){

           

            alert("Acces Granted");           

           

            }else{

                alert("Sorry, try again");

               

                }

       

        }



But nothing happends, what am I missing here.

 

Also is it possible for the password textfield to have hidden characters??

 

Cheers

 

/HRB




Viewing all articles
Browse latest Browse all 2143

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>