Conditional fields
See original GitHub issueIt would be great to have conditional fields. The value of one field influence others visibility (and maybe more ?). For example, I check a checkbox field, and it show another field. It could allow for very dynamic forms. The field would need some sort of meta information about them, for example:
/*schema.js*/
fields: [{
type: "switch",
label: "Add a packaging ?",
model: "packet"
}, {
type: "select",
label: "packet type",
model: "packet_type",
required: true,
values: [
{ id: "standard", name: "Standard" },
{ id: "present", name: "Present" }
]
// Only appear if packet value is true
dependOn: [{ model: "packet", value: true }]
}, {
type: "text",
label: "message to write on the note",
model: "present_note",
// Only appear if packet_type selected value of "id" field is "present" AND if packet value is true
dependOn: [{ model: "packet_type", field: "id", value: "present" }, { model: "packet", value: true }]
}]
They could be option for “not this value” and “multiple good values”. Internally, it could use v-show on a computed value that we could add in abstractField.js. That’s just some first ideas and thoughts, please tell me what are you think about that.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Conditional Fields | Drupal.org
Conditional Fields allows you to manage sets of dependencies between fields. When a field is “dependent”, it will only be available for editing ......
Read more >Conditional Fields for Contact Form 7 - WordPress.org
This plugin adds conditional logic to Contact Form 7. If you edit your CF7 form, you will see an additional tag called “Conditional...
Read more >Conditional Fields - DocuSign Support
Conditional fields allow you to create dynamic documents that support a conditional work flow. Conditional fields only appear to the recipient ...
Read more >Understanding Conditional Field Logic - iCIMS Community
Through Conditional Field Logic, user admins can control which profile fields are displayed—and which options are listed for those fields—based on how other ......
Read more >Conditional Fields
With the Conditional Fields macro, you can specify different conditions to customize the form. This is useful for creating dynamic forms that react...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is an exist function. Check the
company.name
field in dev example. You can set avisible
function what lib will execute.So this fields is visible if the model.type is “business”.
I see it is missing from docs
Wouldn’t it be nice to have a declarative way to indicate the dependency, like all the rest of the schema is, instead of functional?