user5858 user5858 - 11 days ago 4
HTML Question

Unable to locate the event handler

I've this html source of this url:

https://login.freecharge.in/login?callbackurl=https://checkout.freecharge.in/payment
. This page has two input fields - login & password.

I want to locate the handler being called when we key-in the login and password. For example when I type these two values then Sign In button gets enabled:

aaaaaaaaaa@gmail.com
password11233455


In the login textfield if I delete last two characters "
om
" by pressing Backspace leaving login to "aaaaaaaaaa@gmail.c" then Sign In automatically gets disabled.

Login field code



The html code of the login field looks like this:

<input id="loginEmailMobile" name="loginEmailMobile" autocomplete="loginEmailMobile" type="text" focus-me="vm.focus == 'LOGIN'" focus-delay="200" ng-focus="frmLogin.loginEmailMobile.blured = false" ng-blur="frmLogin.loginEmailMobile.blured = true" required="" ng-model-options="{allowInvalid:true}" ng-model="vm.data.login.emailOrPassword" ng-maxlength="127" ng-pattern="^(([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4})|([6-9][0-9]{9}))$" no-space="" class="ng-valid-maxlength ng-touched ng-dirty ng-valid-parse ng-valid-required ng-invalid ng-invalid-pattern">


Sign-In Button code



<button value="Submit" class="submit disable" ng-class="{'disable':frmLogin.$invalid}" id="signInButton" ng-click="vm.signinClickHandler(frmLogin.$valid)"><span id="textLoginSignIn">SIGN IN</span></button>


Now I've searched
loginEmailMobile
in all the files and I don't find this except in this code. So who is listening to this element and taking action? How to find it?

Answer

This is done via the Angular framework, with the following patter:

ng-pattern="^(([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4})|([6-9][0-9]{9}))$"

It means if the input does not look like an email, the field is not valid. Then, you didn't post this code, but most likely on the button there's something like ng-enabled="..." with a condition that checks if the email field is valid.

Comments