Submit button of Login form is not working

I have attached my sample here BackEnd and FrontEnd… I didn’t able to find out the reason behind, “why my submit button of login form is not working”…Can anyone help me out?..

This is part of your code:

<form id="login-form3" #loginForm="ngForm" (ngSubmit)="OnSubmit(UserName.value,Password.value)">
    <ion-item id="login-input9">
      <ion-label>
        Username
      </ion-label>
      <ion-input type="text" #UserName ngModel name="UserName" placeholder=""></ion-input>
    </ion-item>
    <ion-item id="login-input10">
      <ion-label>
        Password
      </ion-label>
      <ion-input type="password" #Password ngModel name="Password" placeholder=""></ion-input>
    </ion-item>
  </form>
  <button id="login-button2" ion-button color="positive" block>
    Login
  </button>

I guess the problem is that the button is out of your form tag. Remove your button and add a button inside the form tag in the following way:

<form id="login-form3" #loginForm="ngForm" (ngSubmit)="OnSubmit(UserName.value,Password.value)">
    <ion-item id="login-input9">
      <ion-label>
        Username
      </ion-label>
      <ion-input type="text" #UserName ngModel name="UserName" placeholder=""></ion-input>
    </ion-item>
    <ion-item id="login-input10">
      <ion-label>
        Password
      </ion-label>
      <ion-input type="password" #Password ngModel name="Password" placeholder=""></ion-input>
    </ion-item>
    <ion-item>
         <button id="login-button2"  ion-button type="submit" color="positive" block>Login</button>
    </ion-item>
  </form>
1 Like

And also, you can use this page Ionic and Forms to see how to add a form correctly

Yes…worked, Thanks Sir

Glad I could help :wink: