# Custom button for ion-select through \[selectOptions\] not working

**URL:** <https://forum.ionicframework.com/t/custom-button-for-ion-select-through-selectoptions-not-working/157305>\
**Category:** ionic-v3\
**Created:** [February 23, 2019, 3:12pm UTC](https://forum.ionicframework.com/t/custom-button-for-ion-select-through-selectoptions-not-working/157305 "2019-02-23T15:12:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![puremonk](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/puremonk/32/121726_2.png) [@puremonk](https://forum.ionicframework.com/u/puremonk)\
**Post date:** [February 23, 2019, 3:12pm UTC](https://forum.ionicframework.com/t/custom-button-for-ion-select-through-selectoptions-not-working/157305/1 "2019-02-23T15:12:13Z")

</div>

I want an ion-select with one button saying ‘save’. I also want to use a handler for that button.  
This is what my ion-select alert looks like currently:  
 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/e/7/e742c3c9c60f6ecd9b4d6fa215d7a2814a3a2230.png)

The ‘cancel’ and ‘ok’ buttons should be replaced by just one ‘save’ button.  
I was able to change the title and message of the ion-select alert, but for some reason the buttons won’t change.  
In the docs it says this should be possible [select - ionic API](https://ionicframework.com/docs/v3/api/components/select/Select/#select-options)  
**Note** : this select is a component.  
In my .ts file:

```auto
this.selectOptions = {
      title: this.global.translate.selectPark,
      message: this.global.translate.onlyChooseOnce,
      buttons: [
        {
          // Save button
          text: this.global.translate.save,
          handler: () => {
            console.log('Save clicked');
            this.storage.set(this.parkKey, this.parkValue).then((value) => {
              console.log('storage.set returs: ', value);
              this.parkLocationChoose.setParkValue(this.parkValue);
            })
          }
        }
      ]
    }

```

my html:

```auto
<ion-select #parkSelect [selectOptions]="selectOptions">
      <ion-option *ngFor="let park of parks" [value]="parkValue">
        {{ park }}
      </ion-option>
</ion-select>

```

---

<div class="post-metadata">

**Author:** ![puremonk](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/puremonk/32/121726_2.png) [@puremonk](https://forum.ionicframework.com/u/puremonk)\
**Post date:** [March 6, 2019, 11:18am UTC](https://forum.ionicframework.com/t/custom-button-for-ion-select-through-selectoptions-not-working/157305/2 "2019-03-06T11:18:35Z")

</div>

So I found out why it’s not working, Ionic disables it in the Select class:  
Source: [Ionic select on github](https://github.com/ionic-team/ionic-v3/blob/510190d457019530867e8932f6a858a108453372/src/components/select/select.ts#L271) (see the code below)

I find this very conflicting with the docs which [say](https://ionicframework.com/docs/v3/api/components/select/Select/#select-options):  
“Since `ion-select` uses the `Alert` , `Action Sheet` and `Popover` interfaces, options can be passed to these components through the `selectOptions` property. This can be used to pass a custom title, subtitle, css class, and more”

```auto
  open(ev?: UIEvent) {
    if (this.isFocus() || this._disabled) {
      return;
    }

    console.debug('select, open alert');

    // the user may have assigned some options specifically for the alert
    const selectOptions = deepCopy(this.selectOptions);

    // make sure their buttons array is removed from the options
    // and we create a new array for the alert's two buttons
    selectOptions.buttons = [{
      text: this.cancelText,
      role: 'cancel',
      handler: () => {
        this.ionCancel.emit(this);
      }
    }];

```

---

<div class="post-metadata">

**Author:** ![peterjc](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@peterjc](https://forum.ionicframework.com/u/peterjc)\
**Post date:** [October 29, 2019, 12:42pm UTC](https://forum.ionicframework.com/t/custom-button-for-ion-select-through-selectoptions-not-working/157305/3 "2019-10-29T12:42:22Z")

</div>

Bummer, I wanted to intercept the button handlers as well.
