Comments (6)
@ChinuxParibus
Thanks for opening the issue.
I believe there are still problems with using numbers for the values in a QSelect
or QOptionGroup
.
If you change this to strings it should work.
Also please note if you use a checkbox option group that can have multiple options inside an array, you will have to check the problematicID
's array if it includes your value: formData.problematicID.includes()
like so.
/*schema1.js*/
const mySchema = {
schema: [
{
id: 'problematicID',
label: 'Does it work?',
component: 'QOptionGroup',
type: 'checkbox',
default: () => [],
options: [
{ label: 'Yes', value: '1' }, // see string for value '1'
{ label: 'No', value: '2' }
]
},
{
id: 'doeswork',
label: 'It does work :)',
component: 'QInput',
evaluatedProps: ['showCondition'],
showCondition: (_, { formData }) => formData.problematicID.includes('1')
// see string for value '1' in the showCondition
PS: you probably wanna use the dev tools to how the formData.problematicID
value actually looks after checking some boxes. Just so there's no surprises.
I will look into this further, but let me know if this solves your issue.
from quasar-ui-easy-forms.
As for your other issue:
Also, if I change the order of the schemas in the array, does not make the conditional rendering, though.
I believe that perhaps the easy form is not re-rendered after making modifications to the schema
prop passed. (but again, will need to double check.)
This is for performance reasons → I'll need less watchers.
There are a million ways you can work around this. One way is to provide all possible orders inside the schema from the start when the easy form is rendered, and have the fields shown or hidden via showConditions, so that it reflects your preferred order based on whatever dynamic logic you have going on.
Another way is to re-render the entire easy-form by changing a key
prop you apply to the easy form tag. However, this might reset the user input, so you might need to also keep a copy of your formData in the parent component.
from quasar-ui-easy-forms.
@ChinuxParibus
Yeah basically you can do this:
<EasyForm :key="counter" />
and
return default {
data () { return { counter: 0 } }
}
Then if you increment the counter, the form is re-loaded and therefore reset. :)
If you update the schema before you increment the counter, it gets reloaded with the new schema.
This is true for all Vue components btw, not just EasyForms. 😉
from quasar-ui-easy-forms.
I could circumvent this issue declaring the id of the field as a key, explicitly into the v-model attr.
So, partial
look like this: partial: {problematicID: []}
But this should not happen since I'm separating the partial schemas of the form with unique keys.
You read it from an avocado.
from quasar-ui-easy-forms.
Another way is to re-render the entire easy-form by changing a key prop you apply to the easy
form tag. However, this might reset the user input, so you might need to also keep a copy of your
formData in the parent component.
Thanks for your kind response :)
That's exactly the behavior I'm looking for because the definition of my partial schemas have some "prelations" between them, so showCondition
has to reset that partial form in particular. Maybe that's the reason why didn't throw any errors.
I'll be giving a try and I will let you know if it works.
from quasar-ui-easy-forms.
@ChinuxParibus the new version has dedicated documentation on how to reset the form!
see #43
from quasar-ui-easy-forms.
Related Issues (20)
- Add checkbox field HOT 1
- feat(EasyField) Add support for computed fields HOT 1
- review `format` and `parseInput` HOT 1
- plans for VERSION 1 HOT 1
- add validation HOT 1
- evaluated Props: changing dynamic options should reset values lower in hierarchy HOT 1
- Validation: "There are remaining errors" should disappear when all errors are removed HOT 1
- refactor(EasyField) make style & class props usable HOT 1
- refactor(EasyForm) disable field-error padding by default when no rules HOT 1
- formData should not include `undefined: undefined` when there are schema fields without ID HOT 1
- How do you reset the formData when submission to the database is successful? HOT 7
- change dateformat from YYYY/MM/DD to DD/MM/YYYY HOT 6
- Change position of action buttons HOT 3
- fields not editable in edit mode HOT 2
- display external validation messages HOT 8
- Compatibility with q/app v2 HOT 7
- Update easyFormValue at run time HOT 4
- Use QExpansion HOT 1
- New version: Blitzar
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 quasar-ui-easy-forms.