0

Currently I am working on PWA project. In that I am using ionic-vue package. I am using ion-input for taking user input in form but required and size properties not working.

Code for vue component:

<template>
<div>
<ion-header>
  <ion-toolbar>
    <ion-icon name="close" class="close-icon" @click.prevent="redirectTo(close)"></ion-icon>
    <ion-title>{{ title }}</ion-title>
  </ion-toolbar>
</ion-header>
<ion-content class="occupie-field" padding>
  {{ content }}
  <div>
    <ion-input class="modal-ion-input"
      :placeholder="rootElement.$t('number-of-person')"
      type="number" mode="ios" inputmode="decimal"
      :value="total_person"
      @input="total_person = $event.target.value"
    ></ion-input>
    <ion-input class="modal-ion-input"
      :placeholder="rootElement.$t('name')"
      :value="booking_name"
      @input="booking_name = $event.target.value"
    ></ion-input>
    <ion-input class="modal-ion-input"
      :placeholder="rootElement.$t('mobile-no')"
      type="tel" inputmode="tel"
      :value="contact_number"
      @input="contact_number = $event.target.value"
    ></ion-input>
    <ion-input class="modal-ion-input"
      :placeholder="rootElement.$t('gstin-no')"
      :value="gst_no" size="15" type="text"
      @input="gst_no = $event.target.value"
    ></ion-input>
    <!-- <tags-input
      element-id="tags"
      :existing-tags="available_table_list"
      :typeahead="true"
      :showAddedTags="true"
      typeahead-style="dropdown"
      :delete-on-backspace="false"
      :only-existing-tags="true"
      placeholder="Merge Table"
      @tag-added="onTagAdded"
      @tag-removed="onTagRemoved"
      v-model="selectedTags"
    ></tags-input> -->
    <!-- <ion-list> -->
    <ion-item class="select-tablee">
      <ion-label hidden>{{rootElement.$t('select-tables')}}</ion-label>
      <ion-select  :placeholder="rootElement.$t('merge-table')" multiple="true" value="merge_tables" @ionChange="selectChange($event)" :disabled="Object.keys(available_table_list).length === 0">
        <ion-select-option v-for="(table, index) in available_table_list" :key="index" :value="index">{{ table }}</ion-select-option>
      </ion-select>
    </ion-item>
    <!-- </ion-list> -->
  </div>
  <ion-button class="occupie-table-button" @click.prevent="submit" :disabled="disableBtn">{{rootElement.$t('occupie-table')}}</ion-button>
</ion-content>

When I add required property in ion-input then required property not working and form submitted without checking.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Jinal Somaiya
  • 1,931
  • 15
  • 29

1 Answers1

1

see this - https://gist.github.com/mlynch/2ff3692341276ba959fea96a620097f9

try

<IonInputVue v-model="contact_number" size="10"/>
Aaron Saunders
  • 33,180
  • 5
  • 60
  • 80