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

Examine having inter field dependencies (hiding fields) (this can be combined with the existing cascade feature) #382

Open
ldoliv opened this issue Nov 24, 2015 · 9 comments
Assignees
Milestone

Comments

@ldoliv
Copy link

ldoliv commented Nov 24, 2015

Hello,
In a fieldgroup I have a dropdown select "Option A" and "Option B".
I also have other fields, example: title and subtitle.

Would it be possible and easy to implment the functionality?
When choosing "Option A" show both title and subtitle fields.
When choosing "Option B" only show the title field.

The subtitle field could still be saved when article form submit, that depends on how you would implement this.
To me important is to hide "subtitle" field when selecting "Option B" from the dropdown.

@ggppdk
Copy link
Member

ggppdk commented Nov 24, 2015

  • for questions or discussing new features, please use our forums first

the idea you suggest would be done by adding this feature to 6 fields:
select(multiple), radio(image), checkbox(image)

  • which already have "cascading" feature

Because this is similar and related to cascade feature

will need

  • the JS code for item form to handle form changing events
    (similar to what we have now)
  • plus the initialization on item form load (PHP) to parse the show-hide configuration,
    (this should be a configuration that is flexible enough ...)
  • just unlike cascade feature, we do not need to do AJAX server calls and have server task

In order to be complete, it should be as above,
this may have to wait to be done properly and not do a quick hack

  • for your case you can simple add some JS code to your form that will attach to fields' onchange event and hide show the container of the desirable fields, so you do not have wait for this to be implemented

@ggppdk ggppdk added this to the 3.1.0 milestone Nov 24, 2015
@ggppdk ggppdk self-assigned this Nov 24, 2015
@ldoliv
Copy link
Author

ldoliv commented Nov 25, 2015

Ok, I will add the js to the form. Thank you for considering this feature. Good work!

@ggppdk
Copy link
Member

ggppdk commented Nov 25, 2015

e.g. see this:
http://stackoverflow.com/questions/31407977/hide-element-based-on-value-of-other-elements

  • the needed JS code should be small, and our fields have unique id in their top level containers (item form)
    e.g. container_fcfield_27

@ggppdk
Copy link
Member

ggppdk commented Nov 25, 2015

Also we have parameters for JS code inside the backend type form, that will be added only when the particular type is being edited

@ldoliv
Copy link
Author

ldoliv commented Nov 25, 2015

I'll see how it goes and report back. :)

@ggppdk ggppdk changed the title Possible to have inter field dependencies? Examine having inter field dependencies (hiding fields) (this can be combined with the existing cascade feature) Nov 25, 2015
@ldoliv
Copy link
Author

ldoliv commented Dec 1, 2015

I managed to do it, I would like to send you my code, can I send to your email ?

@ggppdk
Copy link
Member

ggppdk commented Dec 1, 2015

hello,

you don't need to send, basic code do this is trivial

  • and we are doing it already in parameters dependencies, in much more complex way (see the date scope in universal module) and in other places
  • to do this with proper and handle all cases is more work, e.g. it will be multi-level

will do this in proper time

@ldoliv
Copy link
Author

ldoliv commented Dec 1, 2015

ok, thanks anyway.

@ggppdk
Copy link
Member

ggppdk commented Dec 1, 2015

Your feature request is quite useful,

  • and a large number of users will find this useful, and will use it, if available
  • this has been asked / suggested by others too

that is why it has 3.1.0 milestone

  • just for general usage, it needs to be done properly
    because once we add a feature it is difficult to change it / improve it without breaking existing installations

@ggppdk ggppdk modified the milestones: 3.2.1, 3.3.0 Feb 27, 2017
@ggppdk ggppdk modified the milestones: 3.2.0, 3.2.1 Feb 28, 2017
@ggppdk ggppdk modified the milestones: 3.2.2, 3.3.0 Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants