Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ionic3 Alert with Input Text and Radio Button

$
0
0

@OliverPrimo wrote:

Hello everyone,

I want to create an ionic alert that will have both radio buttons and text inputs. I have three options and if the user chose the third option, an input text will appear and the user needs to type something.

Here is my code and the sample output.

let alert = this.alertCtrl.create({
        title: 'Select one?',
        message: "Please select one or enter something",
        inputs: [
          {
            type: 'radio',
            label: 'Option 1',
            value: 'Option 1',
          },
          {
            type: 'radio',
            label: 'Option 2',
            value: 'Option 2',
          },
          {
            type: 'radio',
            label: 'Other Option',
            value: 'Other Option',
          },
          {
            type: 'text',
            placeholder: 'Enter other option',
          }
        ],
        buttons: [
          {
            text: 'Submit',
            handler: (data: any) => {
              console.log(data);
            }
          }
        ]
      });
      alert.present();

image

I’ve searched on the internet but I can’t find something that can help me with this. I hope someone can help me with this.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>