Giter Site home page Giter Site logo

martinmurciego / dynamic-form-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fraygit/dynamic-form-generator

0.0 2.0 0.0 1.75 MB

Prototype to generate form dynamically, written on node js, sails js and mustache js

JavaScript 99.75% HTML 0.25%

dynamic-form-generator's Introduction

prototype-programme

a Sails application

The purpose of this prototype is to demostrate how the advanced forms can dynamically be built through configurating the fields of the programme on a administration page and by simply applying a template without the trouble coding the fields on the html for each programme.

This is written in Node JS using Sails MVC and mustache for templating on the front-end.

Administration Page

In the backoffice, the administrators can view and add programmes: http://localhost:1337/programme/view


Alt text


and when the programme is clicked. The details will be displayed, showing all the fields that has been setup. Fields as broken into sections, administrator can add a section and add a field within a section.


Alt text


The application can spit out a json equivalent of the details of the programme by adding &isRest=true parameter on the url.


Alt text


On the front end side, you only need to pass the programme Id and the template and the form will automatically display the form.

this is how the client script look like:


Alt text


understanding the parameter:

the engine will take two parameters:

pass the programme id:

data: {Id: 1013, isRest: true},

pass which template:

var template = $("#template-gasp").html();

the code above is actually pointing to a template file, for this case gasp.html, each template file can be the advanced form, e.g. gasp. this is a mustache template, the template will consume the JSON and iterate on the fields and will automatically displays them, leaving only the specific to the form will be needed to be coded e.g. for gasp decision support, etc..


Alt text

the rendered form http://localhost:1337/advanceform/view :


Alt text


TODO

  1. Create a REST that template can consume to save the data from the form.

dynamic-form-generator's People

Watchers

 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.