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

How to pre-fill a form for record update? #3

Closed
martinhbramwell opened this issue Mar 16, 2018 · 5 comments
Closed

How to pre-fill a form for record update? #3

martinhbramwell opened this issue Mar 16, 2018 · 5 comments

Comments

@martinhbramwell
Copy link

The docs and demo need to show the steps to mutate the store so that the form is filled.

Is there a mutation for the entire form? Must it be mutated one field at a time?

Where is the namespace used and how?

@justin-schroeder
Copy link
Member

Yep, we need to add that to the docs too. Fields can be given an initial value with :initial=“value” and the entire form can be hydrated the same way :initial=“{email: ‘justin@me.com’, name: ‘Justin’}”.

@martinhbramwell
Copy link
Author

... and namespace? :-)

@justin-schroeder
Copy link
Member

What about the namespace? Are you talking about module namespaces?

@martinhbramwell
Copy link
Author

Yep. The docs discuss namespaced modules, but if an external entity writes to the store what is the command?

Maybe your example could include a namespaced module, written to by the first one?

@justin-schroeder
Copy link
Member

Using direct mutations is not fully supported yet. Please see #6. Once support for that has been added we can update the docs to reflect it. However, the namespacing is just standard vuex namespacing. The current mutations are:

setFieldValue()
setFieldErrors()
setFieldValidationErrors()
setFieldMeta()
resetForm()
removeField()

To call them directly you just call store.commit('setFieldValue', {form, field, value}). To call them when using namespaces: store.commit('namespace/setFieldValue', {form, field, value}) – but this is just standard vuex notation, not specific to vue-formulate.

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

2 participants