ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.03k stars 13.51k forks source link

bug: AlertController not allowing multiple input types #19089

Closed UltimateGemini closed 4 years ago

UltimateGemini commented 5 years ago

Bug Report

Ionic version: Latest

Current behavior: AlertController is not allowing different types of inputs at the same time. (e.g..text with checkbox)

Expected behavior: To allow checkbox, text, url, date, number input types to be mixed.

Steps to reproduce: Add AlertController to TS file.

Related code:

const alert = await this.alertController.create({
      header: 'Test',
      message: 'testing',
      inputs: [
        {
          name: 'name1',
          type: 'text',
          placeholder: 'Placeholder 1'
        },
        {
          name: 'checkbox1',
          type: 'checkbox',
          label: 'Checkbox 1',
        }
      ]

StackBlitz Demo

NiklasMerz commented 4 years ago

This seems to be a feature request. Per documentation alerts are not designed to allow that:

Radios, checkboxes and text inputs are all accepted, but they cannot be mixed. For example, an alert could have all radio button inputs, or all checkbox inputs, but the same alert cannot mix radio and checkbox inputs. Do note however, different types of "text" inputs can be mixed, such as url, email, text, textarea etc. If you require a complex form UI which doesn't fit within the guidelines of an alert then we recommend building the form within a modal instead.

https://ionicframework.com/docs/api/alert#inputs

UltimateGemini commented 4 years ago

Im pretty sure that wasn't in the docs a year ago when i was working on this. Thanks for the reply.. a year later.

NiklasMerz commented 4 years ago

I just came across this issue too right now

ionitron-bot[bot] commented 4 years ago

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.