GithubHelp home page GithubHelp logo

formio / formio-question Goto Github PK

View Code? Open in Web Editor NEW
2.0 6.0 5.0 6.25 MB

A directive that provides question and answer capabilities for Form.io forms.

Home Page: http://formio.github.io/formio-question/

License: MIT License

JavaScript 70.05% HTML 29.95%

formio-question's Introduction

This repository is now considered legacy and no longer supported. Please take a look at our recent repositories and help documentation at the following links.

Form.io Question

An Angular.js directive that provides quiz capabilities to a Form.io form using the following simple directive.

<formio-question src="'https://project.form.io/form'" question="componentKey"></formio-question>

This directive uses the Component Key for rendering a specific portion of a Form as a single aggregate submission.

Options

The following options are available for the directive, to further customize the output:

src

{Required, String} The url for the form being used as a questionnaire.

question

{Required, String} The API key of the form component to be displayed as a question.

form

{Optional, Object} The form containing the current question. If provided, the directive will not query the API, and uses this definition
as the cached value. Helpful when displaying more than one question.

submissions

{Optional, Array} The submissions for the form containing the question. If provided, the directive will not query the API, and uses the
given values as the cached answers. Helpful when displaying more than one question from the same form.

submission

{Optional, Object} If provided, the question will use the provided submission object

wait-for-promise

{Optional, Promise} If provided, the directive will wait until the promise resolves, before rendering the question or answer.

preview-results

{Optional, Boolean, default: false} If provided, the results button will be available before a submission has been made.

update-answer

{Optional, Boolean, default: false} If provided, the results page will contain a question button to allow the submission to be changed.

chart

{Optional, String: default: 'table'} If provided, the results will be displayed using the given type.

Available: table, pie, word cloud

chartAdvanced

{Optional, Object} If provided, nvd3 will use these options for a chart rather than an internal type. Requires `chartDataCustomizer` if provided.

See NVD3 Documentation for more information.

chartDataCustomizer

{Optional, Function} If provided, the results of all submissions will be run through this function before given to the chart defined in
chartAdvanced. A single parameter data will need to be modified to fix the key:value pairs for the provided chart.

Getting Started

You will first need to create an account at https://form.io. Go there now and sign up for a free account.

Installation

To install this within your application, you will need to use bower.

bower install formio-question --save

Then, you will need to add the wizard and its dependencies to your HTML page.

To include the Angular dependency, use: formio-question/dist/question-full.min.js To NOT include the angular dependeny, use: formio-question/dist/question-complete.min.js

<link rel="stylesheet" href="https://cdn.rawgit.com/formio/ngFormio/v1.2.1/dist/formio-full.min.css"/>
<script src=""https://cdn.rawgit.com/formio/formio-question/1.0.0/dist/question-full.min.js"></script>

Now, you will need to add this to your Angular.js module as a dependency like the following.

angular.module('myApp', ['formio.question']);

Example

Take a look at index.html for an example implementation of this quiz capability.

How it works

This directive uses form components to render specific questions. Because of this, you will need to create your form and supply a component API key to the directive for rendering.

IFrame

IFrame embedding questions is possible with the following parameters and the given url.

URL: http://formio.github.io/formio-question/iframe.html

form

{Required, String} The url for the form being used as a questionnaire.

question

{Required, String} The API key of the form component to be displayed as a question.

preview

{Optional, Boolean, default: false} If provided, the results button will be available before a submission has been made.

update

{Optional, Boolean, default: false} If provided, the results page will contain a question button to allow the submission to be changed.

chart

{Optional, String: default: table} If provided, the results will be displayed using the given type.

Available: table, pie, word cloud

Example IFrame Embed Code:

<iframe src="http://formio.github.io/formio-question/iframe.html??form=https://cuibqcmhuqgqhat.form.io/form/56ba3a5374d7d2010082d5fc&question=thefirstjava1Question&preview=true&update=false&chart=pie" height="500px" width="500px"></iframe>

License

MIT

formio-question's People

Contributors

travist avatar zackurben avatar

Stargazers

 avatar  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.