Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Ion-input is broken with 4.7.x #19084

Closed
eulerchavez opened this issue Aug 13, 2019 · 6 comments
Closed

bug: Ion-input is broken with 4.7.x #19084

eulerchavez opened this issue Aug 13, 2019 · 6 comments
Labels
package: angular @ionic/angular package type: bug a confirmed bug report

Comments

@eulerchavez
Copy link

Bug Report

Ionic version:

[x] 4.7.x

Current behavior:

Ionic input control not working and refreshing UI as expected

Expected behavior:

Prevent write value on disabled ion-input control and Change detection should refresh the UI

Grabación de pantalla 2019-08-13 a las 11 50 38

Related code:

<!-- Anticipo a rentas incluido -->
            <ion-col size-xs="12" size-lg="4">
              <ion-item mode="md" class="item-form-group switch">
                <ion-label (click)="anticipoARentasIncluido.setValue(!anticipoARentasIncluido.value)">
                  Anticipo a rentas incluido
                </ion-label>
                <ion-toggle formControlName="AnticipoARentasIncluido" (ionChange)="handleAnticipoRentasIncluido($event)"></ion-toggle>
              </ion-item>
            </ion-col>

            <!-- Anticipo a rentas con IVA -->
            <ion-col size-xs="12" size-lg="4">
              <ion-item mode="md" class="item-form-group" [disabled]="anticipoARentasIncluido.value != true">
                <ion-label position="stacked">Anticipo a rentas con IVA</ion-label>
                <ion-input #inputAnticipoRentas type="text" inputmode="numeric" maxlength="13"
                  formControlName="AnticipoARentas" (ionChange)="handleCommissionsPercent($event)"
                  [brmasker]="{money: true, thousand: ',',  decimalCaracter: '.', decimal: '2'}">
                  <ion-icon name="logo-usd" slot="start" class="money-icon"></ion-icon>
                </ion-input>
              </ion-item>
              <div class="error-container" *ngIf="anticipoARentas.touched == true && anticipoARentas.errors">
                <div class="error-message" *ngIf="anticipoARentas.errors['required']">
                  <ion-icon name="information-circle-outline" aria-label="invalid input"></ion-icon>
                  <span>Campo obligatorio</span>
                </div>
              </div>
            </ion-col>
handleAnticipoRentasIncluido(event: CustomEvent) {

    const value = event.detail['checked'];

    if (value == true) {

      this.anticipoARentas.setValidators([Validators.required]);
      this.anticipoARentas.updateValueAndValidity();
      this.changeDetectorRef.detectChanges();
      this.anticipoARentas.markAsTouched();
      
    } else {
      
      this.anticipoARentas.clearValidators();
      this.anticipoARentas.updateValueAndValidity();
      this.changeDetectorRef.detectChanges();
    }
  }

Ionic info:

Ionic:

   Ionic CLI                     : 5.1.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.4
   @angular-devkit/build-angular : 0.13.0
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.3.1
   @ionic/angular-toolkit        : 1.4.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 13 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.7 (update available: 0.2.8)

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.1
   NodeJS     : v10.16.0 (/usr/local/bin/node)
   npm        : 6.9.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.2.1 Build version 10E1001
@ionitron-bot ionitron-bot bot added the triage label Aug 13, 2019
@liamdebeasi
Copy link
Contributor

Thanks for the issue. Are you able to provide a Stackblitz/repo with a reproduction of the issue? I am unable to reproduce this issue on my end. You can use this link as a base Stackblitz: https://stackblitz.com/edit/ionic-v4-angular-tabs

I have provided a Stackblitz of a working ion-input + forms demo here: https://stackblitz.com/edit/ionic-v4-angular-tabs-fmeseo.

Thanks!

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Aug 15, 2019
@ionitron-bot ionitron-bot bot removed the triage label Aug 15, 2019
@eulerchavez
Copy link
Author

eulerchavez commented Aug 15, 2019

Thanks for the issue. Are you able to provide a Stackblitz/repo with a reproduction of the issue? I am unable to reproduce this issue on my end. You can use this link as a base Stackblitz: https://stackblitz.com/edit/ionic-v4-angular-tabs

I have provided a Stackblitz of a working ion-input + forms demo here: https://stackblitz.com/edit/ionic-v4-angular-tabs-fmeseo.

Thanks!

Hi there,

In this Stackblitz I was able to reproduce all the issues and one more, when I use markAsTouched, the input not display the "red line".

https://stackblitz.com/edit/ionic-v4-angular-tabs-z2mmyk

Thanks 🙏

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Aug 15, 2019
@liamdebeasi
Copy link
Contributor

Apologies for the delay in response. I was able to reproduce this and will look into a fix. As a temporary workaround, you can set the disabled property directly on the ion-input rather than the ion-item. Thanks!

@liamdebeasi liamdebeasi added package: angular @ionic/angular package type: bug a confirmed bug report labels Oct 28, 2019
@ionitron-bot ionitron-bot bot removed the triage label Oct 28, 2019
@liamdebeasi
Copy link
Contributor

Hi there,

We are proposing some changes to form components that seek to resolve this issue. We would love your feedback on these proposed changes! You can read more about the changes and leave comments here: #25661

@liamdebeasi liamdebeasi added type: bug a confirmed bug report and removed type: bug a confirmed bug report labels Nov 14, 2022
liamdebeasi added a commit that referenced this issue Nov 15, 2022
@liamdebeasi
Copy link
Contributor

Thanks for the report. In Ionic 7 we will be introducing a new syntax for using form components such as ion-input. You can find a summary of the changes here: #25661

The reported issue is fixed with this new syntax. Work to update ion-input to use this new syntax has been completed, so I am going mark this issue as resolved. We plan to have a public beta period for Ionic 7 in the future. You can visit the Ionic Blog, Ionic Twitter, or our GitHub Releases Page to be notified when the Ionic 7 beta is released. Let me know if you have any questions. Thanks!

@ionitron-bot
Copy link

ionitron-bot bot commented Dec 15, 2022

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: angular @ionic/angular package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

2 participants