# Ng-submit form not working when ion-select is present

**URL:** <https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786>\
**Category:** ionic-v3\
**Created:** [February 15, 2017, 8:46pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786 "2017-02-15T20:46:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucascrandle](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lucascrandle](https://forum.ionicframework.com/u/lucascrandle)\
**Post date:** [February 15, 2017, 8:46pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786/1 "2017-02-15T20:46:43Z")

</div>

When including an ion-select inside of a form it won’t submit by pressing enter. If I comment out the ion-item that contains the ion-select. Then the form will respond with the enter key.

Here is the html:

```
<ion-header>
  <ion-toolbar>
    <ion-title>test</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content padding>
  <form ng-submit="testClick()">
  <ion-item>
      <ion-label>New Status</ion-label>
      <ion-select [(ngModel)]="statusSelection" name="statusOptions">
        <ion-option >test1</ion-option>
        <ion-option >test2</ion-option>
      </ion-select>
    </ion-item>

  
    <ion-item>
      <ion-label>Memo</ion-label>
      <ion-input [(ngModel)]="person" name="person"></ion-input>
    </ion-item>

  <button ion-button type="submit" style="float: right;" (click)="testClick()">Click</button>
</form>

</ion-content>

```

and the ts:

```
import { Component } from '@angular/core';

import { ModalController, Platform, NavParams, ViewController } from 'ionic-angular';

@Component({
  templateUrl: 'hello-ionic.html'
})
export class HelloIonicPage {
  statusOptions: string[] = ['test1','test2'];
  statusSelection: string = 'test1';

  constructor(public modalCtrl: ModalController) { }

  testClick(){
    console.log('Cicked');
  }
}

```

Does anyone have a suggestion?

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [February 15, 2017, 8:57pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786/2 "2017-02-15T20:57:12Z")

</div>

It looks like [this was supposed to have been fixed several months ago](https://github.com/driftyco/ionic/issues/5596).

---

<div class="post-metadata">

**Author:** ![lucascrandle](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lucascrandle](https://forum.ionicframework.com/u/lucascrandle)\
**Post date:** [February 15, 2017, 9:12pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786/3 "2017-02-15T21:12:03Z")

</div>

Thanks rapropos,  
That is similar but his enter triggered as error, where in this case simply nothing happens and I don’t see any errors in the console.

Ionic info in case that’s asked for:  
ordova CLI: 6.5.0  
Ionic Framework Version: 2.0.1  
Ionic CLI Version: 2.2.1  
Ionic App Lib Version: 2.2.0  
Ionic App Scripts Version: 1.0.0  
ios-deploy version: Not installed  
ios-sim version: Not installed  
OS: Windows 7  
Node Version: v7.4.0  
Xcode version: Not installed

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [February 15, 2017, 9:23pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786/4 "2017-02-15T21:23:27Z")

</div>

What happens if you change “ng-submit” to “(ngSubmit)”?

---

<div class="post-metadata">

**Author:** ![lucascrandle](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lucascrandle](https://forum.ionicframework.com/u/lucascrandle)\
**Post date:** [February 20, 2017, 2:25pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786/6 "2017-02-20T14:25:38Z")

</div>

> [@rapropos](#):
>
> (ngSubmit)

Interestingly, this causes the “testClick()” function to be called twice. However, still no trigger when pressing the enter key.

---

<div class="post-metadata">

**Author:** ![lucascrandle](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lucascrandle](https://forum.ionicframework.com/u/lucascrandle)\
**Post date:** [February 20, 2017, 2:40pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786/7 "2017-02-20T14:40:40Z")

</div>

Actually that did work, still waking up this morning and forgot to have the cursor in the text input before pressing enter.

However, I had to remove the “(Click)” from the button, as pressing that would submit the click on the button, and the form submission for the form. This resulted in the method being called twice. FYI for anyone else referencing this.

Thanks for the help rapropos!

Here is the updated html:

```
<ion-header>
  <ion-toolbar>
    <ion-title>test</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content padding>
  <form (ngSubmit)="testClick()">

  <ion-item>
      <ion-label>New Status</ion-label>
      <ion-select [(ngModel)]="statusSelection" name="statusOptions">
        <ion-option >test1</ion-option>
        <ion-option >test2</ion-option>
      </ion-select>
    </ion-item>

  
    <ion-item>
      <ion-label>Memo</ion-label>
      <ion-input [(ngModel)]="person" name="person"></ion-input>
    </ion-item>

    <button ion-button type="submit" style="float: right;">Click</button>

</form>

</ion-content>
```

---

<div class="post-metadata">

**Author:** ![jjo422](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jjo422](https://forum.ionicframework.com/u/jjo422)\
**Post date:** [March 26, 2017, 8:29pm UTC](https://forum.ionicframework.com/t/ng-submit-form-not-working-when-ion-select-is-present/79786/8 "2017-03-26T20:29:18Z")

</div>

Try to do it with:

```
   <form [formGroup]="example" (ngSubmit)="exampleSubmit()">

 <ion-item>
      <ion-label>New Status</ion-label>
      <ion-select formControlName="statusSelection" name="statusOptions">
        <ion-option >test1</ion-option>
        <ion-option >test2</ion-option>
      </ion-select>
    </ion-item>
 <button ion-button type="submit" [disabled]="!account.valid">Submit</button>
  </form>
```
