Giter Club home page Giter Club logo

Comments (8)

Pagebakers avatar Pagebakers commented on July 18, 2024

If it's an update form, you don't need to use step.data but you can just pass the document to the form.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

pass the doc to main form or all step form

// Template
{{> wizard id="productUpdate" steps=steps doc=data.........

// JS
Template.productUpdate.helpers({
    data: function () {
        var data = Collection.Product.findOne(this._id);
        return data;
    },

// Step
{#autoForm id="generalStep" schema=step.schema}}......
{{#autoForm id="loanAmountStep" schema=step.schema}}......
{{#autoForm id="chargStep" schema=step.schema}}......

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

No that's not gonna work, you can reuse the same doc for each step, but best would be to return the doc with only the fields used in the specific form.

{#autoForm id="generalStep" schema=step.schema doc=doc}}......
{{#autoForm id="loanAmountStep" schema=step.schema doc=doc}}......
{{#autoForm id="chargStep" schema=step.schema doc=doc}}......

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

It mean that don't pass doc to main for, but pass data to each step

// Template
{{> wizard id="productUpdate" steps=steps

// JS
Template.productUpdate.helpers({
 steps: function () {
        return [
            {
                id: 'general',
                title: 'General',
                template: 'generalStep',
                formId: 'generalStep',
                schema: Schema.Product.general,
                data: function () {
                    var data = Collection.Product.findOne(this._id);
                    return data;
                },
            },
             ..............................

            {
                id: 'charge',
                title: 'Charge',
                template: 'chargStep',
                formId: 'chargStep',
                schema: Schema.Product.charge,
                data: function () {
                    var data = Collection.Product.findOne(this._id);
                    return data;
                },
                onSubmit: function (data, wizard) {
                    var self = this;
                    var extend = _.extend(wizard.mergedData(), data);
                    // update doc
                }
            }
        ]
    }

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

Yeah I get the idea, but that's not supported at this time. So you have to pass the doc directly to the autoform in your steps.

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

If you read through the closed issues, there are some examples using an update/insert form.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Thanks, look great 👍

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

But now it have problem when I submit update form.
It don't get the new value on previous step (It still get the initial value).
Please help me.

from meteor-wizard.

Related Issues (20)

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.