0.3.0 • Published 4 years ago

@dzeio/form-manager v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Form Manager

A powerfull Manager for all your forms

Table of Content

Installation

nothing difficult

yarn add @dzeio/form-manager
or
npm install @dzeio/form-manager

usage

Typescript

import FormManager from '@dzeio/form-manager';

const fm = new FormManager(docuement.getElementById("form"));

// add modules
import { FMRepeatAssignment } from '@dzeio/FormManager/modules/FMRepeatInput'

fm.assign(FMRepeatAssignment)

// or

import FMDateInput from '../FormManagerGit/modules/FMDateInput'
fm.assign({
    input: FMDateInput,
    type: "date",
    tagName: "input"
});

// After adding modules run to reffect modules to inputs
fm.setupInputs();

// verify form validity:
fm.verify(); //return true if valid else return false
// if it returns false you can use the variable under to see th FMInput that isnt valid
fm.lastErroredInput

// submit your data to an endpoint
fm.submit("/api/idk", (ev) => {/* onloaded callback*/}, /* verify datas beforehand default:true*/ true)

// get the json of your form
fm.getJSON()

// fill form from URI (datas MUST be in JSON (see getJSON for examples))
fm.fillFromURI("uri")

// same as before but you give the json from ts
fm.fillFromJSON(json)

// change if you only see the form or edit them
fm.setMode(FMMode.ViewMode or FMMode.EditMode)

// same thing as before but just for one field
fm.setModeForInput(FMMode.ViewMode or FMMode.EditMode, "inputName")

// Reset the form to it's defaults values
fm.clear()

Modules & Attributes

Modules

Module nameDescription
DatalistManage the datalist better than ever !
DateManage the date element
FileManage single file uploads
RepeatMake your fields repeatable !
SelectFix your Select

Attributes

Attribute nameDescription
data-autosetUpdate your value in near realtime
data-defaulta better value than value
data-ignorei don't see this
data-regexregex your value

Issues

Complete listing here

Changelog

here

0.3.0

4 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

1.0.0

5 years ago