Git Product home page Git Product logo

sepomex-form-plugin's Introduction

![[Made with Love by Icalia Labs](https://img.shields.io/badge/With%20love%20by-Icalia%20Labs-ff3434.svg)]

SepomexForm with Google Maps integration facilitates the use of forms with addresses in your application.

About

SepomexForm helps you to easily manage your forms with address information.

SepomexForm brings you easy implementation of form filling using Google Maps Api, by automatically filling fields based on a Google Maps marker, and by placing markers based on form information.

SepomexForm has a second functionality, by using the Sepomex API, it allows fields of your form to be automatically filled when typing more specific information. See below for examples and a more thorough explanation.

SepomexForm has even a third functionality! It migrates all data from Sepomex Api to JSModels

Installation using npm:

  1. Install sepomex-form-plugin via npm:

    	run npm install sepomex-form-plugin
  2. Include Google Maps Api. You will need an API key, if you don't have one you can get it here:

    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>
  3. Include plugin's code:

    	<script src="./node_modules/sepomex-form-plugin/dist/sepomex-form-plugin.min.js"></script>
  4. Call the plugin:

    $.fn.sepomexForm();

Installation of Google Map Sepomex Form:

  1. Include jQuery:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  2. Include Google Maps Api. You will need an API key, if you don't have one you can get it here:

    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>
  3. Include plugin's code:

    <script src="dist/sepomex-form-plugin.js"></script>
  4. Call the plugin:

    $.fn.sepomexForm();

Installation of Autocompleting with Sepomex Api:

  1. Include jQuery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  1. Include plugin's code:
<script src="dist/sepomex-form-plugin.js"></script>
  1. Call the plugin:
  $.fn.sepomexForm();

Table of Contents

Configuring SepomexForm

Default config

By default SepomexForm uses the following IDs in order to know what fields have to be filled, if you wish to use the default configuration then you must use these ids in you containers otherwise SepomexForm will not behave as expected.

  {
    formContainer: "#AddressForm",
    mapContainer: "#MapWrapper",
    numberContainer: "#AddressNumber",
    streetContainer: "#AddressStreet",
    suburbContainer: "#AddressSuburb",
    cityContainer: "#AddressCity",
    stateContainer: "#AddressState",
    countryContainer: "#AddressCountry",
    zipCodeContainer: "#AddressZipCode"
  }
Attribute Type Default Description
formContainer String #AddressForm Specifies the container of the form to be filled.
mapContainer String #MapWrapper Specifies the container for the Map.
numberContainer String #AddressNumber Specifies the input for the number.
streetContainer String #AddressStreet Specifies the input for the Street.
suburbContainer String #AddressSuburb Specifies the input for the Suburb.
cityContainer String #AddressCity Specifies the input for the City.
stateContainer String #AddressState Specifies the input for the State.
countryContainer String #AddressCountry Specifies the input for the Country.
zipCodeContainer String #AddressZipCode Specifies the input for the Zipcode.

Custom config

If you wish to use different ids as the default ones, SepomexForm allows you to override them. In order to do that use the following, before calling the plugin.

  $.fn.sepomexForm.defaults.formContainer = "#CustomFormContainer";
  $.fn.sepomexForm.defaults.mapContainer = "#CustomMapContainer";

  // Plugin call
  $.fn.sepomexForm();

Configuring AutoCompleteForm

Default config AutoCompleteForm

By default AutCompleteForm uses the following IDs in order to know what fields have to be filled, if you wish to use the default configuration then you must use these ids in you containers otherwise AutCompleteForm will not behave as expected.

  {
    suburbContainer: "#AddressSuburb",
    cityContainer: "#AddressCity",
    stateContainer: "#AddressState",
    zipCodeContainer: "#AddressZipCode"
  }
Attribute Type Default Description
suburbContainer String #AddressSuburb Specifies the input for the Suburb.
cityContainer String #AddressCity Specifies the input for the City.
stateContainer String #AddressState Specifies the input for the State.
zipCodeContainer String #AddressZipCode Specifies the input for the Zipcode.

Custom config

If you wish to use different ids as the default ones, AutoCompleteForm allows you to override them. In order to do that use the following, before calling the plugin.

  $.fn.autocompleteForm.defaults.suburbContainer = "#CustomSuburbContainer";
  $.fn.autocompleteForm.defaults.cityContainer = "#CustomCityContainer";
  $.fn.autocompleteForm.defaults.stateContainer = "#CustomStateContainer";
  $.fn.autocompleteForm.defaults.zipCodeContainer = "#CustomZipCodeContainer";

  // Plugin call
  $.fn.autocompleteForm();

JSModels

SepomexForm migrates the data from [SepomexApi] to JsModels. Please refer to its documentation for more about it. here

Contributing

Please submit all pull requests against a separate branch. Please follow the standard for naming the variables, mixins, etc.

Heroes

Ana Paola Treviño

Erik Torres

René García

License

Code and documentation copyright 2015 Icalia Labs. Code released under the MIT license.

sepomex-form-plugin's People

Contributors

erik0686 avatar kurenn avatar renesg avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.