One last piece of functionality I would like to add to my logon page is the fact that when the users
are already in the process of signing in or registering they cannot keep on clicking the submit button.
Now let me show you what I mean by that.
I'm going over to a bigger browser window.
Then we're going to click on inspect.
We're going to go to network and we're just going to make our connection slower.
So we're gonna say let's say fast 3G.
Now what's going to happen if we're going to head over to a console.
And if I'm going to just clear it you can notice that if I'm let's say logging in I can keep on clicking.
And that's not the functionality that I'm looking for.
So what I would like to have is while my alert is displayed so essentially while we are loading or while
we're waiting for our response from the server then the user is not going to be able to submit the form
again.
And you know maybe let me show you with a slow one maybe that's gonna be better.
Again we're going to head over to our console and let me close the alert.
I'm submitting I'm still waiting technically for the data and I can just keep on you know adding to
many requests as you can see right now.
So the way we're going to handle that is we're going to head over first of all to our handle submit.
And the moment we submitted the form the moment we run and submit first we're gonna run alert.
So when I say show alert and then we're gonna pass in the message within our object.
So off message and then we're gonna say accessing user data and then we're gonna say Please wait.
OK.
That's a good start but then also remember when we talked about is empty I'm gonna tie is empty value
to alert show.
So what I'm saying here is if one of these values is of course empty then we cannot submit the form.
Correct.
That was our logic.
So why don't we add one more value here.
And I'm going to say also or alert.
So my alert if this show is true.
So if the show is true is empty is gonna be true.
So if these empty is true then we're not displaying the bottom.
So how it's going to work then we're gonna save it.
We're gonna head over back to our application and pick a browser window and then of course this is just
going to take some while since I have the slow connection.
And now let's try to do that again.
So I'm gonna go John G mail dot com and regardless whether the password is correct or incorrect if I'm
going to submit something notice I'm not going to be able to submit anymore.
So now I'm waiting for my response.
But in this case it was successful.
However let's head over back and try to log in with the wrong credentials and you're going to see again
the same thing.
John and Jim I'll let com whatever long credentials and then I cannot submit the form anymore.
So now I'm waiting for my response.
And then unless I have closed out my alert then of course I cannot submit.
So again I have to specifically close out the alert.
And only then I can resubmit my values.