Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variance in "load submission" method between FormioForm and FormioWizard #111

Closed
rmckeel opened this issue Jun 12, 2017 · 3 comments
Closed

Comments

@rmckeel
Copy link

rmckeel commented Jun 12, 2017

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;
                }
            }
@travist
Copy link
Member

travist commented Jun 14, 2017

This is very strange. I will look into it. On a similar note, you may have noticed that we created a factory that allows you to dynamically create a form based on the type defined in the schema. It works like.

import { Formio } from 'formiojs/full';

let form = 'https://examples.form.io/example'; // This could also be the actual JSON object.
Formio.createForm(form).then((formInstance) => {
  formInstance.submission = {....};
});

Try that and see if that resolves the issue.

@rmckeel
Copy link
Author

rmckeel commented Jun 15, 2017

Nice. Good to know that method exists. I'll try it out.

@shuhaib-aot
Copy link

shuhaib-aot commented Mar 29, 2023

I am rendering form with react-formio and when i use reference and check the validity is return true at the same time I am creating a form with formio.create function using the same data. and giving checking the submission but return false

    console.log(formRef.current.formio.checkValidity()); //true
    const formInstance =  await Formio.createForm(form); 
    console.log(formInstance.checkValidity(submission.data)); //false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants