Repository navigation
bug: fab-button with type "submit" does not submit the form #18550
Copy link
Copy link
Labels
package: core@ionic/core package@ionic/core packagetype: buga confirmed bug reporta confirmed bug report
Description
Bug Report
Ionic version:
[x] 4.x
Current behavior:
Hi, I want to use a fab button type submit inside a form but it doesn't trigger ngSubmit. Please Help.
Expected behavior:
It works when I use a normal button but I wanted to use FAB bc of the style and easily way to put it aligned in the page.
Steps to reproduce:
Related code:
<form [formGroup]="enviarDocumentosForm" style="padding-top: 0;" (submit)="enviarDocumentos(enviarDocumentosForm.value)">
<ion-row justify-content-center align-items-center style="height: 100%; margin:auto;">
<ion-col size-md="6" size-lg="5" size-xs="12">
<div padding>
<ion-row justify-content-center>
<ion-label floating>Digite o CPF do cliente</ion-label>
</ion-row>
<br/>
<ion-row justify-content-center>
<ion-item lines="none">
<div class="ion-text-center">
<ion-input id="nrCpfClienteId" type="tel" formControlName="nrCpfCliente" placeholder="CPF" placego clearInput clearOnEdit="false" maxlength="14" [brmasker]="{form: enviarDocumentosForm.get('nrCpfCliente'), person: true}"></ion-input>
</div>
</ion-item>
</ion-row>
</div>
</ion-col>
</ion-row>
<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button type="submit">
<ion-icon name="cloud-upload"></ion-icon>
</ion-fab-button>
</ion-fab>
</form>
Other information:
There are people with the same issue and the documentation shows that ion-fab-button has type property with submit as option.
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.9.0 (C:\Users\Alex\ambiente\projetos.neon\node_modules\ionic)
Ionic Framework : @ionic/angular 4.4.2
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.3.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 14 other plugins)
System:
NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
Reacted by Obed, glemiere, Chapelant Yoann and gongAll
Metadata
Metadata
Assignees
Labels
package: core@ionic/core package@ionic/core packagetype: buga confirmed bug reporta confirmed bug report
Activity
paulstelzer commentedon Jun 14, 2019
Thanks for your issue! THe reason ion-fab-button does not work with form is correct. Take a look at the ion-button (https://github.com/ionic-team/ionic/blob/master/core/src/components/button/button.tsx#L134) - here you will see the click listener which looks for a form. This is missing in ion-fab-button
If you want you can create a PR, that would be great :)
atsoares commentedon Jun 14, 2019
Oh, sure! For now I just copied the same fab-button css style to the ion-button to solve my problem temporally but I'll do it! It's in the documentation so it should work!
meisterlampe commentedon Jan 21, 2020
Just stumbled over the same problem. Any news on this?
atsoares commentedon Jan 21, 2020
@meisterlampe here is what I did to solve it:
meisterlampe commentedon Jan 22, 2020
Hi.
Thanks for your answer.
This made submit working, but I'm struggling with styling it the same way as the fab button now.
How did you apply the css-style of the fab-button to this ion-button?
atsoares commentedon Jan 22, 2020
@meisterlampe in the page.sccs I changed the ion-button css to the same fab-button css, like this:
meisterlampe commentedon Jan 22, 2020
Works like a charm. Thanks a lot for your fast answer!
[-]support: ion-fab-button type="submit" inside form doesn't work[/-][+]bug: fab-button with type "submit" does not submit the form[/+]fix(fab-button): restore submit, reset, and disabled form functionali…
ShaneK commentedon Aug 5, 2026
Thanks for the issue report and your patience! The fix for this has been deployed as part of v8.8.17!
ionitron-bot commentedon Sep 4, 2026
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.
fix(fab-button): restore submit, reset, and disabled form functionali…