FLEXIcontent / flexicontent-cck

Advanced content management for Joomla
http://www.flexicontent.org
82 stars 53 forks source link

Issues with new custom functionality - Show/Hide fields depending on value of other fields, and nested field groups #1077

Closed maustin92 closed 6 months ago

maustin92 commented 1 year ago

I've been working with Ruben Reyes at Lyquix for the past few years as well as Georgios and have contributed to Lyquix's flexicontent templates (https://github.com/Lyquix/flexicontent_templates), but this is the first attempt at contributing to core flexicontent functionality I've made. While working on some new functionality to use on a client’s site I ran into some issues that I’d like help with resolving.

For the last couple weeks I've been working to create a system of nested field groups as well as an ability to show or hide fields depending on the value of another field. The latter seems to be working well but I am having trouble with the former, namely with creating associations between fields within nested field groups and which parent field group their values should be loaded into when generating the backend form for entering values. I've tried a system where valueorder and suborder are used for these fields when saving data as a start. When it comes to parsing these columns within the table and using them to render the form, however, I’ve hit a roadblock. I’m not sure what step in the process these values should be sent to in a way that the loop for grouped_fields can read them and use them for value sorting. It also seems like the nested group fields are having issues saving their data.

One of the specific issues I've encountered is that when field groups are processed by fieldgroup.php in the backend, nested field groups processed first and when it comes time for their parent field group to add their form field display, their html attribute has already been imploded into a string. I want to pursue a method where the valueorder of the fields within that nested field group can help the parent field group determine which entries of the parent will have the appropriate values. The values of these fields also seem to not save properly, I think something is happening when the form saves that’s tripping it up but I’m not sure what.

Before testing these changes, be sure to add the respective columns to the flexicontent_fields table, otherwise the values for the fields that handle showing/hiding fields will not properly save and the functionality will not work in the backend:

You will also need to refresh the form after filling out the field used to show/hide fields in item forms in order for the fields checking its value to show.

Thanks for any help you can give with helping to build this out and resolve the issues with it.

rubenreyes2000 commented 1 year ago

Here's a video describing what we're trying to accomplish, I hope you find this useful: https://vimeo.com/740485752/12d7e7ade3

@ggppdk - let me know your thoughts, we made significant progress but need a bit of your help.

micker commented 1 year ago

hello Sorry for delay @rubenreyes2000 and @maustin92 did you have some news about this ?

micker commented 6 months ago

hello that added https://www.flexicontent.org/documentation/tutorials-english/79-forms-and-submission/791-how-to-use-showon-in-item-form.html