Comments (24)
Could you help me?
from meteor-wizard.
I'll try to have a look tonight, I don't have much free time recently, sorry.
from meteor-wizard.
Thanks for your helping.
from meteor-wizard.
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.
But don't work with custom template (https://github.com/kepler/meteor-autoform-wizard/).
Now I need you to help me 💯
from meteor-wizard.
Can you please put a working example online, so I can reproduce this and come with a solution?
from meteor-wizard.
It's my repo https://github.com/thearabbit/autoform-wizard-example.git.
Please correct me
- don't show
autoform label
, but It work fine before - update form.
Thanks for your helping.
from meteor-wizard.
Maybe I missing any code, it don't work well.
from meteor-wizard.
Could you help me?
from meteor-wizard.
Yes, today I finally have some time to drop in!
from meteor-wizard.
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.
- You forgot to put quotes around the quick field names:
{{> afQuickField name='name'}}
- Put your
Schema
in common code, for example in/both/schema.js
- Attach the schema to the collection, the schema is not attached, that's why the insert doesn't work.
Good luck
from meteor-wizard.
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 ...:
- I tried to change any data on
step 1
- Click next to
step 2
(but don't clicksubmit
immediately). By theback
, I clickback
tostep 1
again (don't change anything). - The final I click next again (last step), and
submit
, It work fine.
from meteor-wizard.
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.
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.
You have to add the 'collection' to the autoform, otherwise you wont update anything, please read the AutoForm documentation.
from meteor-wizard.
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 ...:
- I tried to change any data on step 1
- 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).
- The final I click next again (last step), and submit, It work fine.
from meteor-wizard.
{{#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.
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.
Oh.., It still don't get data updated on step 1 when submit on last the step (update form).
from meteor-wizard.
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.
So we change doc=step.data
to doc=doc
(helper).
from meteor-wizard.
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.
Cool great!
from meteor-wizard.
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)
- i18n not working for buttons HOT 1
- Example of using onSubmit hook? HOT 1
- Doesn't work for more than two (2) steps HOT 1
- ...
- Multi step form: clicking back then next from 2nd step loses 2nd step's data HOT 2
- Route not updated, when opening an invalid step. HOT 1
- How to initial data for update form? HOT 8
- pathForStep helper adds step ID but link doesn't do anything HOT 5
- Iron Router pathFor helper not working as expected when using Wizard route HOT 2
- Can't move to other steps in wizard in both click events and programmatically after Hard page refresh HOT 4
- wizard.mergedData() return {} HOT 7
- wizard is not cleared for new order HOT 1
- values from previous steps HOT 1
- Wizard undefined HOT 1
- Autoform 6 --allow-incompatible-update HOT 5
- Still working? HOT 3
- Setting to remove steps <ol>? HOT 2
- Not working link in docs
- Implement custom steps template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-wizard.