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

Fields dependent on others (conditional fields) #478

Open
dema121 opened this issue May 21, 2017 · 21 comments
Open

Fields dependent on others (conditional fields) #478

dema121 opened this issue May 21, 2017 · 21 comments
Assignees
Labels
enhancement ♥ NEEDS SPON$OR Help bring this feature to the plugin

Comments

@dema121
Copy link

dema121 commented May 21, 2017

Is it possible to add custom properties to fields in order to save which field is dependent on?
For example a field must appear only if a checkbox is checked or a date input is greater than something.

Is it planned to implement this feature in formBuilder?

@kevinchappell kevinchappell changed the title Fields dependent on others Fields dependent on others (conditional fields) May 25, 2017
@NormanEdance
Copy link

The appearance of the section depending on the radio, select, checkbox value would be cool too, so it would be possible to encapsulate fields into sections.

@mmitsui
Copy link

mmitsui commented Jun 23, 2018

What is the status on this? I just found formBuilder and found it almost suits my needs. :) Except for on this particular issue.

@Darthmaul
Copy link

Hello! I am also really in need of this feature. Is this something that could be developed? I could put some work in if need be.

My idea would be to customize the attributes that appear inside the "edit field" view. I'm not sure how to edit this content, and per #669 maybe nobody is...?

My approach would be:

  • Add a "conditional" section in the field edit area
  • Similar to WordPress' Advanced Custom Fields, I would have the ability to choose an option from an existing field and then have the current field be conditional on that.
    • Obviously you wouldn't want to just be filling these fields while you are building your form, so the option would only look for fields to be conditional on once it is enabled.
    • Once you enable conditional, you would have a list of fields as a select box. You select your field, then based on the selected field, you would see a list of operators.
      • Example: If "text_field_1" equals "yes"
      • This syntax might be a bit confusing. Read it as: This field is conditionally displaying if...
  • There also needs to be basic validation when you go to save your form that the conditions you have input are valid

I think this would be a good starting point, and would limit too many failures as you are going to lock it down to be pretty closed types.
Additionally, I found this library: https://github.com/renvrant/conditionize.js
This library queries off of data-attributes in the constructed forms. While it may be a bad idea to add an external library to this one, I think this is at least something good to look at as a jumping-off point for how to render this on the frontend.

The above mentions the other consideration for this feature. This is both a complicated frontend and backend issue. The rendered forms will have to change a good bit, especially depending on how the conditional fields are showing or hiding.

Anyways, that's my brainstorming on this. I'm going to start digging into the source and see if I can figure it out. Honestly this form builder is so close to exactly what I need, and the only thing I don't have here is the conditional logic. I would love some insight if you have any @kevinchappell as far as how to implement any of this.

Thanks!

@DavidPLamas
Copy link

Hello!

Is there any progress on this feature? Are there any plans to make this work in the future? I've been actively using this plugin and I there has been the urge for this type of feature.

Thanks!

@kevinchappell
Copy link
Owner

kevinchappell commented Nov 3, 2018

@Darthmaul excellent writeup on this, certainly a lot to consider. I have conditional fields working for another form building library and would be willing to port some stuff to formBuilder from it.

@DavidPLamas no progress in formBuilder yet. The edit panel would need to become tabbed to fit conditional settings into it, in my opinion its already too large for some fields.

At the moment I'm focused on conditional fields for Formeo, once 1.0 is released I can look at adding them to formBuilder too.

@kevinchappell kevinchappell self-assigned this Nov 3, 2018
@sivashree
Copy link

Hello, Is there any progress in this feature? I have been using this form builder for the past few months and this feature would be a great addition to the form builder. It is an important requirement of my project too.

@chauhanravinder
Copy link

How I add Conditional Logic in Form Builder

@ghost
Copy link

ghost commented May 23, 2020

Hello, Is there any progress in this feature? I need to add Conditional Logic in Form Builder.

Thanks in advance.

@rendezz
Copy link

rendezz commented May 26, 2020

I am working on a plugin at the moment to add conditional logic. Simple functionality which would suit my needs. Any field can depend on a checkbox, radio or select box. If they are selected, then a field container would become visible and its validation would apply. If thats what people are looking for I can package it up as a deployable alongside formbuilder.

@rendezz
Copy link

rendezz commented May 28, 2020

As promised

https://github.com/rendezz/formbuilder_depends

@nahidshaikh46
Copy link

nahidshaikh46 commented Aug 14, 2020

As promised

https://github.com/rendezz/formbuilder_depends
Hi,
can you upgrade for two or more field depend on one fields.
Thanks & Regards.

@nahidshaikh46
Copy link

Hi,
can you upgrade for two or more field depend on one fields.
Thanks & Regards.

@rendezz
Copy link

rendezz commented Aug 19, 2020

Hi,
can you upgrade for two or more field depend on one fields.
Thanks & Regards.

Unfortunately I don't have much time right now so I won't be looking at this functionality. But you can normally achieve the same by just chaining your depends. A depends on B depends on C. That is B is only seen if C is a value, then A is only seen if B is a value (and obviously seen, thats the chained dependency)

@nahidshaikh46
Copy link

Thanks for reply.
but my requirement is C depend on A & B. if both A & B selected then only C will visible.

@rendezz
Copy link

rendezz commented Aug 19, 2020

Thanks for reply.
but my requirement is C depend on A & B. if both A & B selected then only C will visible.

Ok, but unfortunately the change from depend on 1 to depend on n changes the scope enough for the work involved to be quite significant which I don't have time for currently so I won't be able to get to this until I have a current project myself which requires it

@AnnysStyle
Copy link

Hello, Is there any progress in this feature? I need to add Conditional Logic in Form Builder.
Thanks

@lucasnetau lucasnetau added the ♥ NEEDS SPON$OR Help bring this feature to the plugin label Oct 25, 2023
@ug-code
Copy link

ug-code commented Dec 21, 2023

Hello, Is there any progress in this feature? I am also really in need of this feature.
Thanks in advance for any help on this.

@lucasnetau
Copy link
Collaborator

At the current time there is no work being done on this feature request. PRs are welcome or a Sponsor for the feature.

@stephaneroze
Copy link

How much do you need to sponsor this feature @lucasnetau ?

@Boffice
Copy link

Boffice commented Apr 6, 2024

It is surprising how there is such a low demand on this feature. I love the framework, but conditional logic is main reason I am forced to search for alternatives.

@joncon62
Copy link

I really need this ability too. @Boffice which library are you using instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ♥ NEEDS SPON$OR Help bring this feature to the plugin
Projects
None yet
Development

No branches or pull requests