question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Ionic v4-beta.3] ion-input: validation attributes are not working

See original GitHub issue

Bug Report

Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI) : 4.1.0
   @ionic/core           : 4.0.0-beta.3
   @stencil/core         : 0.11.4
   aurelia-fetch-client  : 1.3.1
   choices.js            : 3.0.4
   handlebars            : ^4.0.11
   ionicons              : ^4.3.0
   quill                 : ^1.3.6
   @stencil/sass         : ^0.1.0

System:

   NodeJS : v8.11.3
   npm    : 5.6.0
   OS     : Windows 10

Describe the Bug Form input validation like required, maxlength, min, max, etc. are not working inside a form

Steps to Reproduce

      <form>
        <ion-list>
          <ion-item>
            <ion-label position="floating">Input</ion-label>
            <ion-input name="input" required maxlength={150} autofocus></ion-input>
          </ion-item>
        </ion-list>
        <button type="submit">Confirm</button>
      </form>

Expected Behavior The input field should be validated on form submit.

Additional Context The ion-input is generating two inputs with the same name: one visible input with validation attributes and one hidden input without the attributes. The form is validation only the hidden input.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
MrSparkllecommented, Sep 16, 2018

The min and max properties also doesn’t work: The input accepts values over 999. The form keeps valid. Tested on BETA-11:

<ion-input type="number" min="0" max="999"></ion-input>

1reaction
manucorporatcommented, Jan 11, 2019

This should be fixed now that shadow-dom has been disabled for ion-input!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Ionic v4-beta.3] ion-input: validation attributes are not working
Run ionic info from a terminal/cmd prompt and paste the output below. ... The input field should be validated on form submit. ......
Read more >
Ionic 3 validation is not working on "invalid && dirty"
I am trying to implement a validation for inputs in Ionic. For some reason the validation is not firing up. Please see my...
Read more >
ion-item - Ionic Framework
ion -item elements for iOS/Android contain text, icons, images, and other custom elements. They're placed in a list and can be input, deleted,...
Read more >
Advanced Forms & Validation in Ionic & Angular | Josh Morony
A FormControl is tied to an input field, it has a value (i.e. the value the user has entered), and a validation state...
Read more >
Ionic Tutorial - Forms and Validations in ionic 5
You won't find the timing issues that sometimes affect a template-driven form. Also, reactive forms can be easier to unit test.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found