Coder Social home page Coder Social logo

formgen's Introduction

Issues I love badges

Preform

Installation

Requirements

  • Node.js 6.11+
  • Some trigger emailing service like mailjet.com

How to install

  • Clone this repo: git clone https://github.com/implose/preform.git
  • Move inside the directory: cd preform
  • Install the npm packages: npm i
  • Customize conf.json
  • Copy form.sample.json to form.json and fill it
  • Pet a cat
  • Enjoy life

TO DO

  • Basic structure
  • Form Customization
  • Sass Customization
  • Mail Service Config
  • Everything else!

Usage

Everything is built from the form.json - so if you mess the structure, it all goes kablooey. So here are a few indications on how to get it right.

Global structure

At the root of the form.json, you'll have 4 properties :

  1. Method
  2. Action
  3. Form
  4. Submit
{
  "method": "post",
  "action": "/",
  "form":[],
  "submit":{
    "action": "Send"
  }
}

So, expectingly, method is the get or post method the form should use - what you put here is what will be in the method attribute of the form tag.
Likewise, action is the destination of your form on submit - what you put here is what will be in the action attribute of the form tag.
submit is an object containing the property action, which value is a string. It is used to customize the submit button.
Finally, the form property is an array of objects, each object will be a field in the final form, more about this below.

Form property and fields

Every object in the form array has at leat these three properties: label, type and name ; and almost all has the placeholder property too.

{
  "label": "This a text field you should fill:",
  "type": "text",
  "name": "textfieldwithagreatname",
  "placeholder": "Enter text at once!"
}

Inputs

Here are the types that are allowed:

  • color
  • date
  • datetime-local
  • email
  • file
  • month
  • number
  • password
  • range
  • tel
  • text
  • time
  • url
  • week

Those are basically almost all input types possible in html5, please note that browsers will behave differently with certain types. Please refer to MDN web docs for more info.

Datalists

Checkboxes, Radios and Selects

formgen's People

Contributors

ctrlaltdev avatar snyk-bot avatar

Watchers

 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.