Skip to content

ctjp/autoform-intl-tel-input

Repository files navigation

AutoForm International Telephone Input Build Status

An add-on Meteor package for aldeed:autoform. Provides a single custom input type, "intl-tel-input", which renders an input using the intl-tel-input plugin.

Prerequisites

The plugin library must be installed separately.

In a Meteor app directory, enter:

$ meteor add ctjp:meteor-intl-tel-input
$ meteor add aldeed:autoform

Installation

In a Meteor app directory, enter:

$ meteor add ctjp:autoform-intl-tel-input

Usage

Specify "intl-tel-input" for the type attribute of any input. This can be done in a number of ways:

In the schema, which will then work with a quickForm or afQuickFields:

{
  tel: {
    type: String,
    autoform: {
      type: 'intl-tel-input',
      'class': 'form-control',
      afFieldInput: {
        inputOptions: {
          autoFormat: true,
          defaultCountry: 'auto'
        }
      }
    }
  }
}

Or on the afFieldInput component or any component that passes along attributes to afFieldInput:

{{> afQuickField name="tel" type="intl-tel-input"}}

{{> afFormGroup name="tel" type="intl-tel-input"}}

{{> afFieldInput name="tel" type="intl-tel-input"}}

To provide intl-tel-input options, set a inputOptions attribute equal to a helper that returns the options object.

About

Custom input type "intl-tel-input" for AutoForm

Resources

License

Stars

Watchers

Forks

Packages

No packages published