Giter Club home page Giter Club logo

Comments (24)

thearabbit avatar thearabbit commented on July 18, 2024

Could you help me?

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

I'll try to have a look tonight, I don't have much free time recently, sorry.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Thanks for your helping.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

I tried to test https://github.com/kepler/meteor-autoform-wizard/ forked from this..
work fine for update, but it seem no longer up to date.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

But don't work with custom template (https://github.com/kepler/meteor-autoform-wizard/).
Now I need you to help me 💯

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

Can you please put a working example online, so I can reproduce this and come with a solution?

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

It's my repo https://github.com/thearabbit/autoform-wizard-example.git.
Please correct me

  1. don't show autoform label, but It work fine before
  2. update form.

Thanks for your helping.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Maybe I missing any code, it don't work well.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Could you help me?

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

Yes, today I finally have some time to drop in!

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

Ok I had a look, there's a lot going on, which is basic Meteor stuff unrelated to the wizard package.
I'll give you a few hints to get it working, but I can't give Meteor suppport here.

  1. You forgot to put quotes around the quick field names: {{> afQuickField name='name'}}
  2. Put your Schema in common code, for example in /both/schema.js
  3. Attach the schema to the collection, the schema is not attached, that's why the insert doesn't work.

Good luck

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Thanks now work fine for insert.
But still problem with update, It don't get data updated on step 1 when submit on last step.
Now I found the problem, If ...:

  1. I tried to change any data on step 1
  2. Click next to step 2 (but don't click submit immediately). By the back, I click back to step 1 again (don't change anything).
  3. The final I click next again (last step), and submit, It work fine.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

It work, if we click back before submit on last step.
But we can't get currentDoc, docId via this to update collection by id.
Could you help me again? now I update repo.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Now I tried in my example repo by don't use data:........ of steps helper

<!--Wizard Step-->
<template name="staffGeneral">
    {{#autoForm id="staffGeneral" schema=step.schema doc=data}}
        {{> afQuickField name="name"}}
        {{> afQuickField name="gender"}}

        {{> wizardButtons}}
    {{/autoForm}}
</template>

<template name="staffContact">
    {{#autoForm id="staffContact" schema=step.schema doc=data}}

        {{> afQuickField name="telephone"}}
        {{> afQuickField name="address"}}

        {{> wizardButtons}}

    {{/autoForm}}
</template>
--------------------------------------
Template.staffGeneral.helpers({
    data: function () {
        var staffId = FlowRouter.getParam('staffId');
        return Staff.findOne(staffId);
    }
});
Template.staffContact.helpers({
    data: function () {
        var staffId = FlowRouter.getParam('staffId');
        return Staff.findOne(staffId);
    }
});

It work fine (can get extend data of the previous step).
But have problem when I click back to the previous step, It don't show value updated on textbox (show init value form database).

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

You have to add the 'collection' to the autoform, otherwise you wont update anything, please read the AutoForm documentation.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Thanks for your reply.
have to add collection to

{{> wizard id="staffUpdate"......
// ------------- or--------------------
`<template name="staffGeneral">
    {{#autoForm id="staffGeneral"..........`

But still problem with update, It don't get data updated on step 1 when submit on last step.
Now I found the problem, If ...:

  1. I tried to change any data on step 1
  2. Click next to step 2 (but don't click submit immediately). By the back, I click back to step 1 again (don't change anything).
  3. The final I click next again (last step), and submit, It work fine.

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

{{#autoForm id="staffContact" collection="Staff" schema=step.schema doc=data}}

another solution would be to add an onSubmit handler to your staffGeneral step and updating the collection from there.

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

I will try soon.
but I should be use steps helper or not.
If use, I should be don't add onSubmit: ........., it is OK?

insertTpl.helpers({
    steps: function () {
       // Set initial data to update
        var initialData = Loan.Collection.Product.findOne(this._id);

        return [
            {
                id: 'general',
                title: 'General',
                template: 'productGeneralStep',
                formId: 'productGeneralStep',
                schema: Schema.Product.general,
                data: initialData
            },

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Oh.., It still don't get data updated on step 1 when submit on last the step (update form).

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

Something like this, so from the bottom of my head

insertTpl.helpers({
    doc: function() { return Loan.Collection.Product.findOne(this._id); },
    steps: function () {
       // Set initial data to update
        var initialData = 

        return [
            {
                id: 'general',
                title: 'General',
                template: 'productGeneralStep',
                formId: 'productGeneralStep',
                schema: Schema.Product.general,
                onSubmit: function(data, wizard) {
                     Load.Collection.Product.update(data._id, data);
                     wizard.next(data);
                 }
            },

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

So we change doc=step.data to doc=doc (helper).

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

Now It work fine for update form, when I separate initial doc by step:

// Update
Template.staffUpdate.helpers({
    steps: function () {
        // Get data for update form
        var staffId = FlowRouter.getParam('staffId');
        var data = Staff.findOne(staffId);

        // Separate initial doc by step
        var initDoc = {};
        initDoc.general = {name: data.name, gender: data.gender};
        initDoc.contact = {telephone: data.telephone, address: data.address};
        initDoc.contact2 = {telephone2: data.telephone2, address2: data.address2};

        return [
            {
                id: 'general',
                title: 'General',
                template: 'staffGeneral',
                formId: 'staffGeneral',
                schema: Schemas.general,
                data: initDoc.general
            },
            {
                id: 'contact',
                title: 'Contact',
                template: 'staffContact',
                formId: 'staffContact',
                schema: Schemas.contact,
                data: initDoc.contact
            },
            {
                id: 'contact2',
                title: 'Contact2',
                template: 'staffContact2',
                formId: 'staffContact2',
                schema: Schemas.contact2,
                data: initDoc.contact2,
                onSubmit: function (data, wizard) {
                    var self = this;
                    var extend = _.extend(wizard.mergedData(), data);

                    console.log(self);
                    console.log(extend);
..............

console.log(extend); // work fine for all step.
console.log(self); // don't get data from AutoForm instance.

Thanks for all your helping 👍 .

from meteor-wizard.

Pagebakers avatar Pagebakers commented on July 18, 2024

Cool great!

from meteor-wizard.

thearabbit avatar thearabbit commented on July 18, 2024

But console.log(self); don't get data from AutoForm instance such as docId, currentData..., it get the data form the last step.

Could I request data:......... support function()?

.......
data: function(){
  .............
  return {..........};
}

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.