1.1.0 • Published 8 years ago

ninjaform v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

Ninjaform

Installation

npm

to install with npm use npm install --save ninjaform

bower

to install with bower use bower install --save ninjaform

include the <vendor-path>/js/ninjaform.js and the <vendor-path>/css/ninjaform.css where <vendor-path> is node_modules or bower_components depending on how you installed into your page and init it

Manual instllation

You can install it manually by cloning this repo or download the .zip file and copying the .js and .css files into your project

Initializatition

$('#ninjaform').ninjaform({ 
  'token':'<your RD Token>', 
  'secret':'<your RD app secret>', 
  'fields':{ 
    'estado':['PR','SC','SP','RS'], 
    'nível':['Iniciante','Intermediário','Avançado','Ninja'] 
  } 
});

Options:

(String) token: your RD API token, available in your API page

(String) secret: your RD API secret, available in your API page

(object) fields: an object containing a set of custom fields that you want to add to your form. (Currently only supports arrays and converts it to tags

(String) actionURL: URL to the RD API - defaults to "https://www.rdstation.com.br/api/1.2/conversions"

(String) namespace: namespace to prepend to the classes of the generated elements - defaults to ninjaform

(Boolean) modal: if set to true, will create a modal and put the form inside of it, and make all matched elements to open the modal when clicked - defaults to false

(Boolean) wrapper: if set to true, will create <div> tags around the inputs - defaults to true

(Boolean) bootstrap: if set to true, will put bootstrap classes into the form and its wrappers (if they exist, of course) - defaults to true

Example

You can check the testpage.html file and the src/testpage folder to see a basic working example.