1 Reply Latest reply on Nov 12, 2014 5:49 PM by vivekuma

    how to link javascript function to my edge animate project?

    jsfullr Level 1

      I currently have a working email form using PHP in my edge animate project and am trying to add form validation to it.

       

      I am having trouble linking this code to my project (or just adding it in) for basic email validation but edge gives me a syntax error each time I do?

       

      This is the simple javascript I want to run:

       

      function IsEmail(email) {
        var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        return regex.test(email);
      }
      
        • 1. Re: how to link javascript function to my edge animate project?
          vivekuma Adobe Employee

          You can attach this function to the stage symbol in the stage compositionReady event handler like below:

                             sym.IsEmail = function (email) { 

                                  var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 

                                 return regex.test(email); 

                             }


          and then can use this function anywhere like this:    sym.IsEmail (emailToXYZ);         //where sym denotes the stage symbol


          hth,

          Vivekuma