GithubHelp home page GithubHelp logo

formio / formio.js Goto Github PK

View Code? Open in Web Editor NEW
1.8K 83.0 1.0K 1.45 GB

JavaScript powered Forms with JSON Form Builder

Home Page: https://formio.github.io/formio.js

License: MIT License

JavaScript 46.48% CSS 0.05% HTML 37.13% SCSS 8.25% Ruby 0.01% Less 6.93% EJS 1.15%
form-schema vanilla-js vanillajs angular react vue forms

formio.js's Issues

Application slows down: Angular infinite digest loop

screen shot 2016-02-25 at 09 50 38
screen shot 2016-02-25 at 09 50 45

Hi Zack,

i'm trying to use Form.io to build beautiful forms. I've downloaded the repository and have it up and running with MongoDB.
One of my needs is to build a form with a table. For example the table has 9> rows and 5 columns, each column has a different input. This works (as the only form builder i've found) like a charm.
I face only one issue. For example when I reach row 6 and drag and drop a number form control into one of the columns the application gets real slow. I've checked and this is for both the local version as the cloud version on Form.io.

When i check the console Angular is giving errors (which also slows down the console real bad).
The error:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations

I've also added screenshots for my example table and the total console logs.

I hope you could help.
Thanks in advance,

Bas van de Pol

ES6 compatibility

Using the sample code:

import {Formio} from 'formiojs';
...

        let formio = new Formio('https://examples.form.io/example');
        formio.loadForm((form) => {
            console.log(form);
            formio.saveSubmission({data: {
                firstName: 'Joe',
                lastName: 'Smith',
                email: '[email protected]'
            }}).then((submission) => {
                console.log(submission);
            });
        });

I receive the JS error:
formiojs_1.Formio is not a constructor

This also happens trying to use new FormioForm(document.getElementById('my-div'));

Any thoughts on why this basic 'hello world' script to load a sample form would not work inside another (otherwise working) ES6 app?

Thanks!

Ryan

default "keypress" submit form

I also find that the library has a default eventlistener for all component which trigger a form submit on keypress. This is not the default behavior on the form.io portal.
Is there any way we can disable it?

Submit button remains disabled after errors are fixed

When using the JS renderer, the submit button is disabled when form has errors. However, when valid data is entered into the errored fields and field level errors are dismissed, form level errors remain and submit button is still disabled.

Translations not loading for Select elements

I'm trying to use the i18n translations to enable multiple languages on my forms.
All the components change the language correctly except for the Select and Resource components, that all the labels remain the same.

Is there something particular that we have to do to translate these components?

Change the main file in package.json

i've been working with react-formio, and i've made this change there, when working with commonjs and more specific, with webpack, it is better to provide the commonjs (not compiled version) of the code, so if you are not using any code that needs to be transpiled with babel or something like that is better to set the main to the source file to avoid this:

./~/formiojs/dist/formio.js
Critical dependencies:
1:479-486 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
 @ ./~/formiojs/dist/formio.js 1:479-486
{
   "main": "dist/formio.js"
}
//to
 {
   "main": "src/formio.js"
}

Select "searchField" option not triggering request

Hi!

The form is rendered, and the select initial options are rendered, but when url data source and searchField are set, no request is triggered when i type in the select seach box. I checked my endpoint in data.url and is returning a valid json, but no new request is triggered after the initial one that populate the select.

Is there an error with my select component config?

I have followed the documentation that is show in https://help.form.io/userguide/form-components/#search-query-name

Here is an example of how i'm loading the form.

$(document).ready(function(){
    var form = new FormioForm(document.getElementById('formio'));
    form.form = {
        components: [
            {
                input: true,
                tableView: true,
                placeholder: "Opción",
                data: {
                    url: "http://page.com/formio/api/options/58"
                },
                dataSrc: "url",
                valueProperty: "value",
                template: "{{ item.text }}",
                type: "select",
                searchField: "query"
            }
        ]
    };
});

Text field description

Does Formio.js not support text field description (text under the input), even if component has a description property?

Request Hook Plugin on Resource Loading (question)

I'm trying to find a way to hook up in the middle of a resource get request, to try to load data locally for a Select component (that calls an external URL) rather than going to the defined URL.

I thought that the "request" hook plugin would do, but actually, it is not called in this type of Ajax calls.

Which would be the right way to resolve this call locally?

Thank you!

Module identifier warning when building with Webpack

WARNING in ./~/formiojs/src/Formio.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:

  • C:\Git\proximus\node_modules\formiojs\src\Formio.js
    Used by 1 module(s), i. e.
    C:\Git\proximus\node_modules\formiojs\src\providers\storage\url.js
  • C:\Git\proximus\node_modules\formiojs\src\formio.js
    Used by 7 module(s), i. e.
    C:\Git\proximus\node_modules\react-formio\lib\components\Formio.js
    webpack: bundle is now VALID.

Library not accessible via bower as a bower component

C:\ent>bower search formiojs
No results.

missing

  • bower.json bower-main-files (!!)
  • build folder (?) (there ist a require('./build/utils') in dist folder)

npm is building the dependencies, but bower not, also in dist folder should contain only the ES5 transpiled builded ready-to-use code

differences between ng-formio and formio.js when loading a submission

when using the full submission url for a form submission, the submission loads and renders fine in an angular 1 application using ng-formio. When doing the same using formio.js (which this library wraps) the form and submission have issues.

  1. when using drop down select boxes with JSON as the list type the drop down fails to populate unless the json is string encapsulated.
  2. submission values fail to load in the select box fields and select list fields.

It appears the issues relate to formio.js. the ng-formio library doesn't appear to wrap formio.js like ng2-formio does.

select value fails to preload

Sorry for the short description (in a hurry). When preloading data, the form correctly renders, but the underlying data for select input types is missing. This causes form validation to fail on submit, even though it actually looks correct.

Wiki example for "Form Renderer" does not work as intended

Hey Travis and team,

Thought I'd mention this example returns this:

Uncaught ReferenceError: FormioWizard is not defined at window.onload

Additionally, it returns a 404 on the CSS

I would have changed it in the wiki, but I'm not sure what to change it to. Seems there is another way to call the form wizard now from the form.min.js code other than 'FormioWizard'?

Thanks!

Problem pre-filling data grid elements

I have a data grid element where people can add x number of text fields, while I can pre-fill basic fields the grid does not behave in the same way when trying to pre-fill some of the form fields on page load.

  var form = new FormioForm(document.getElementById('formio'));
  form.src = 'path-to-form';
  form.submission = {
      data: {
        addressStreet: '123 Something Street', // works
        addressSuburb: 'Somewhere', // works
        addressPostcode: '40000', // works
        licencePlates: [
            {
                textField: "abc123"
            },
            {
                textField: "another"
            }
        ]
      }
    };

The address fields prefill and when doing a console.log on form.submission after adding some data grid items through the form itself it comes back in the same format as the pre-fill object.

Does the data grid component have any pre-fill ability at present? Is it limited to basic fields?

Wizard Submit Button Does Not Have Animation

Description:
When a user submits a wizard form
Then the submit button does not have any animation informing the user that the form is in the process of being submitted.

Expectation:
Animation should be added to the wizard submit button

Select components do not respect tab index

It seems as though select components are not respecting the tab index values set in form.io portal.

Here is how our tab indexes are set up (marked in red):
image

Behavior on form.io preview:
When viewing the form above on form.io preview and tabbing through the fields, once the user tabs into field 8 (Marital Status), then the tab index proceeds to prioritize the other select components below, so the order of tabbing is as follows: 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14
However, when values are set for these select components, the tab index is working as expected.

Behavior on vanilla js renderer:
Select components are being ignored by tab index. So, the order of tabbing on our front-end is as follows: 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 14
Setting the values for these select components does not change this ordering.

Expected behavior:
Select components should respect the tab indexes set in form.io portal

"Adding a new resource" not working

Hi,
I'm trying to render a form with a resource component within it, but even when I'm capable of render the resource type component and display the records related to the resource itself, it seems like the library not support the inclusion of a button for adding a new resource like it does in the ngFormio library

This is my JSON schema sample:

"components" : [{
        "project" : "",
        "defaultPermission" : "",
        "input" : true, 
        "tableView" : true, 
        "label" : "Customer", 
        "key" : "customer", 
        "placeholder" : "", 
        "resource" : "my_resource_id", 
        "defaultValue" : "", 
        "template" : "<span>{{ item.data }}</span>", 
        "selectFields" : "", 
        "searchFields" : "", 
        "multiple" : false, 
        "protected" : false, 
        "persistent" : true, 
        "validate" : {
            "required" : true
        }, 
        "type" : "resource", 
        "hidden" : false, 
        "clearOnHide" : true, 
        "tags" : [

        ], 
        "conditional" : {
            "show" : "", 
            "when" : null, 
            "eq" : ""
        }, 
        "addResource" : true, 
        "addResourceLabel" : "Add"
    }]

This is what I expect to see:
sample_1
This is what I actually see:
sample_2

The only thing that is rendered is the resource field and not the resource field + the "add" button like it should.

cannot abort submission

Forgive me if I missed this in the docs, but there appears to be no way to abort a submission. Returning false from the submit handler has no effect. Is there another way to do this?

form.on('submit', function(submission) {
    return false;  // the form still submits
});

Validation of un-required email field

Trying to embed a form using the one-liner script tag outlined here[1], served in a flat page using:

<script src="https://unpkg.com/formiojs@latest/dist/formio.embed.min.js?
    src=https://examples.form.io/example"></script>

Can't seem to apply any kind of validation to an email component without the validation being applied to an empty field. Effectively, the submit dismisses my un-required/empty field as being improperly formatted.

Although the submit error is technically accurate, it doesn't seem appropriate for this case. Am I misinterpreting the intended behavior?

[1] https://github.com/formio/formio.js/wiki/Form-Renderer#form-embedding

Error messages for fields with reg ex validation

When the reg ex validation for a field fails, the error message actually shows the regular expression to the user (see screen shot). Is there anyway we can customize the error message when the reg ex validation fails? Or provide a better generic error message?

regex_error

Long running forms

Hi,

Not so much an issue as to more a design pattern, but how would FormIO support the completion of a form over a number of sessions?

For example, a user signs in on Monday and completes forms section 1 to 3. They then realise they don't have all the information to hand to complete the form. They save the form as-is and sign out. The next day, when they have sourced the information they log back in and continue completing the form before submitting.

Terry

Wizard fails to display JSON data after 1st panel

I loaded a form with initial submission data using JSONs for both the form itself as wells as the data.

However, I found that only the 1st visible panel got the fields populated. Any other panels, after navigating to them, shows blank pages.

I checked that the form.submission are trimmed after I assign them to the form.

Grateful if you can look into the issue.

Calendar does not hide when icon is clicked a second time

Using js renderer, the calendar icon is now clickable and opens the calendar for date selection. However, when the icon is clicked a second time, the calendar persists.

Additionally, if the time feature is enabled on this component, then the calendar persists after date is selected. I'm not sure if this is expected or not.

[Select] Choices JS - Brower freezing with a large dataset of values

Hello guys, We have an issue with a Select (i've seen that Formio is using Choices JS) receiving a large amount of values (700 rows). It takes some time for the Select to render and meanwhile the browser is freezing.

Do you have an idea ? I have tried to look into the code. Disabling the sort in the configuration helps a little bit but the browser is still freezing.

Thank you very much for your help.

Listen for cancel event with FormRenderer?

I'm successfully using FormioForm and FormioWizard to display forms in my application. However, pressing the cancel button just resets the form...

I would like to be able to listen for a built in event like 'cancel' so I can customize the behavior of clicking the cancel button such as navigating to a different page.

preloading submission data with signature

Is it expected that signatures are not redrawn when loading previously saved submissions?

EDIT: When I submit the form with the preloaded signature, it will quickly show the preloaded picture. Why doesn't it show after the form initially renders?

boolean values are transformed to string values

In my form, I'm using a two option Radio component, and trying to store true/false (as a boolean). But upon submission, formio converts the value to string, and will not load submissions into the form unless it is a quoted "true" or "false" value.

Am I missing something? Is this correct behavior? It seems incorrect to me.

"Tried to load angular more than once."

Hello!

formio-complete.min.js:53 WARNING: Tried to load angular more than once.

This is my "app":

    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
    <script type="text/javascript" src="//npmcdn.com/ng-formio@latest/dist/formio-complete.min.js"></script>
</head>
<body>
    <div id="main">
        <p>Content.</p>

        <formio style="outline: 2px solid green;" src="'https://gyxqbhairwmxoyw.form.io/contact'"></formio>
        <script type="text/javascript">
            angular.module('formioApp', ['formio']);
            angular.bootstrap(document, ['formioApp']);
        </script>

bug in calculateValue

The existing logic:
var val = eval('var value = [];' + this.component.calculateValue.toString() + '; return value;');

should be:
var val = eval('var value = [];' + this.component.calculateValue.toString() + '; value;');

Multiple Query Strings set in url

I noticed a bug in formio.form.js for loading submission items. Right around Line 5535, the url variable is setting multiple query strings.

image
This is the result of a select box change.

image
This was a workaround fix I used while doing some testing. The comment out line worked.

Variance in "load submission" method between FormioForm and FormioWizard

Not sure if this is intended (perhaps it just needs to be documented), but I found that on FormioForm, setting this.form.submission works, however using FormioWizard, you have to set the data specifically, and nothing happens (no data loaded) when you set this.form.submission.

Put another way, FormioWizard does not accept the submission parameter, but it does accept the data parameter.

Here is some sample code to illustrate the difference between form and wizard handling that currently works in my application. Thanks for any thoughts!

            this.bindElement = this.elementRef.nativeElement.querySelector('.my-form');
            if ('wizard' == this.type) {
                this.form = new FormioWizard(this.bindElement);
            } else {
                this.form = new FormioForm(this.bindElement);
            }

            this.form.src = this.src;

            if( this.submission ) {
                if( 'wizard' == this.type ) {
                    this.form.data = this.submission.data;
                } else {
                    this.form.submission = this.submission;
                }
            }

Phone number field does not bring up the number keypad in mobile device

Given a user log into form on mobile device (i.e iOS)
Phone number field does not bring up the number keypad in mobile device

"We believe this is happening because the type attribute is set to text rather than number, e.g.: 'input name="data[phoneNumber]" type="text" class="form-control" lang="en" placeholder="Enter Phone Number" tabindex="7"'"

submit resets submission object

In about the past week, this bug showed up for me: submitting the form resets the submission data. However, the data in the change handler, prior to submitting, is correct.

form.on('change', function(value) {
    console.log({data: value.data});  // <---- data is correct
});

form.on('submit', function(submission) {
    console.log(submission);  // <---- data is lost
});

Loading with systemjs after upgrade of ng2-formio

I had to add files to the build directory in order to properly handle the relative links to load providers and utils from build/formio.js

formiojs/build/ requires the addition of the something to the effect of following:

providers.js

'use strict';
module.exports = require('./providers');

utils.js

'use strict';
module.exports = require('./utils');

Cookies not sent during request

Hello,

When a request is made by formio (to get the values of a "select" component for example), the "Cookies" HTTP header is not sent.

This is causing issues because we need an information from the cookies to authenticate the request.

Can you help us please ?

I have to tried to play the "Plugin Hooks" but i haven't managed to get it working. Here is what our code looks like:

let DelayPlugin = {
            priority: 1,
            request: function (requestArgs) {
                console.log(requestArgs);
            }
        }

Formio.registerPlugin(DelayPlugin, 'delay');

Select Boxes not rendering (inside Datagrid)

I'm using the FormioForm library to render my forms. Everything works as expected, but when I try to create a "Select Box" component inside a Panel inside a Datagrid (Datagrid with a panel) the Select Box stops rendering and the render fails with the following error.

SelectBoxes.js?a051:104 Uncaught (in promise) TypeError: Cannot read property '4132' of null
at eval (SelectBoxes.js?a051:104)
at arrayEach (_arrayEach.js?3ea6:15)
at forEach (forEach.js?df4f:38)
at SelectBoxesComponent.setValue (SelectBoxes.js?a051:103)
at eval (Components.js?9320:420)
at arrayEach (_arrayEach.js?3ea6:15)
at forEach (forEach.js?df4f:38)
at PanelComponent.setValue (Components.js?9320:409)
at eval (DataGrid.js?230d:136)
at arrayEach (_arrayEach.js?3ea6:15)

Best Regards,

Ignacio

Register new component

Hi dears
How can I register new component. please help me for registering new component.
thanks

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.