Ionic-framework: keyboard in ion-searchbar does not show 'search' button but 'return' button

Created on 14 Apr 2016  Â·  5Comments  Â·  Source: ionic-team/ionic-framework

ion-searchbar in ios, when focused, the keyboard will show "return" button but not the "search" button. especially in chinese language.

Most helpful comment

        <form action=".">
                <ion-searchbar
                        [(ngModel)]="searchKey"
                        [ngModelOptions]="{standalone: true}"
                        [showCancelButton]="true"
                        (search)="searchWithKeyword(activeTab)"
                        (ionCancel)="onCancel($event)"
                        [placeholder]="somePlaceHolder"
                        [animated]="false"
                        [value]=""
                        name="search"
                >
                </ion-searchbar>
            </form>

I have used form with action="." which is working for for me in IOS

All 5 comments

FInally I found the solution: add form tag to surround ion-searchebar

<form>
    <ion-searchbar></ion-searchbar>
</form>

I had to use [ngModelOptions]="{standalone: true}"

<form>
    <ion-searchbar [ngModelOptions]="{standalone: true}"></ion-searchbar>
</form>

Otherwise I was getting error

Error: If ngModel is used within a form tag, either the name attribute ...

        <form action=".">
                <ion-searchbar
                        [(ngModel)]="searchKey"
                        [ngModelOptions]="{standalone: true}"
                        [showCancelButton]="true"
                        (search)="searchWithKeyword(activeTab)"
                        (ionCancel)="onCancel($event)"
                        [placeholder]="somePlaceHolder"
                        [animated]="false"
                        [value]=""
                        name="search"
                >
                </ion-searchbar>
            </form>

I have used form with action="." which is working for for me in IOS

<form action=".">
        <ion-searchbar (search)="search()"></ion-searchbar>
</form>

action="." worked for me.

@anjum121 you truly are the king of kings.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gio82 picture gio82  Â·  3Comments

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  Â·  3Comments

vswarte picture vswarte  Â·  3Comments

brandyscarney picture brandyscarney  Â·  3Comments

SebastianGiro picture SebastianGiro  Â·  3Comments