ctjp:autoform-intl-tel-input

v0.2.0Published 11 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

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:

1{
2  tel: {
3    type: String,
4    autoform: {
5      type: 'intl-tel-input',
6      'class': 'form-control',
7      afFieldInput: {
8        inputOptions: {
9          autoFormat: true,
10          defaultCountry: 'auto'
11        }
12      }
13    }
14  }
15}

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

1{{> afQuickField name="tel" type="intl-tel-input"}}
2
3{{> afFormGroup name="tel" type="intl-tel-input"}}
4
5{{> 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.