Jump to content

Dynamic Selects (Commercial Module)


kongondo

Recommended Posts

40 minutes ago, kongondo said:

I have no idea ?. I have never used Form Builder. Does Form Builder work with custom fields? Honestly, I don't know how it works. 

Good question. I’ve never used it before either although I bought it and keep renewing it.

Link to comment
Share on other sites

  • 4 months later...

@kongondo

Thanks for this great module.

Could you confirm if I'm just trying to do something that just isn't possible? In the notes it mentions that the trigger "must be the exact name of a previous column" - does that mean that it can be any previous column or does it have to be its previous column?

Scenario

So let's say I have 3 dropdowns. Is it possible for the first dropdown to be a trigger for the second AND third dropdown?

I'm trying to achieve the following steps:

  1. Ask the user to select a background colour from the first dropdown
  2. Based on what they pick I'm trying to allow them to select a text colour and a highlight colour via the 2nd and 3rd dropdowns
  3. The options in the 3rd dropdown are not dependant on the options from the 2nd dropdown. I was thinking that the answer to the first dropdown would give two further options.

For reference, I have set up a page in the tree to hold sub pages for my background colours.

218039282_Screenshot2022-03-01at16_08_54.png.1c5bf3746df08dada8e571bf6363c83e.png

Within each of them I have two page reference fields that are displayed as checkboxes - 1 for text colour and one for highlight colour.

43755623_Screenshot2022-03-01at16_09_27.thumb.png.647fa1cae815ba714a6376c858a33acd.png

The idea is that I can set up colour combinations that work well and let the user select only from the allowed options for each background colour.

I've set up the dynamic select field like so. As you can see the 2nd and 3rd column are set to trigger from the first colum.

1445112455_Screenshot2022-03-01at16_08_17.thumb.png.e4f066fba1e58a106ca55776b51c5828.png

Result

When I select the background colour from the 1st select, both the second and third select are populated with the options from select 2 twice.

1377880338_Screenshot2022-03-01at16_10_04.thumb.png.7095d0f31b80f53a6b3ba006985906ae.png

1211217072_Screenshot2022-03-01at16_15_54.thumb.png.eb844a49b627a313f0ac8223681ea9e5.png

However, it does work fine if I just have text colour or highlight colour columns. As they are not dependent on eachother and not directly related I'm guessing that's where my issue is, but I just wanted to check in case I'm missing a trick here.

I hope that explains things well enough? Thanks in advance for your time.

Link to comment
Share on other sites

15 hours ago, 999design said:

Thanks for this great module.

Thanks for the purchase :-).

15 hours ago, 999design said:

In the notes it mentions that the trigger "must be the exact name of a previous column" - does that mean that it can be any previous column or does it have to be its previous column?

Sorry the notes weren't clear. It must be the adjacent (immediate previous) column. So, yes, 'its previous column'. Please see the docs here, especially the introduction and the section on column relationships.

15 hours ago, 999design said:

When I select the background colour from the 1st select, both the second and third select are populated with the options from select 2 twice.

This is because both the 2nd and the 3rd columns are related to the first. The duplicate values getting shown in 3 are due to the JavaScript which determines the select to populate based on the trigger. In your case, your target selects 2 and 3 have an identical identifier (built off the field name 'background_colour'), hence both get populated.

15 hours ago, 999design said:

but I just wanted to check in case I'm missing a trick here.

No, you are not missing anything. What's happening is expected behaviour. The cascade is strictly one-to-one (trigger-dependent selects relationship). 

Incidentally, I am soon reworking Dynamic Selects to use htmx. That will open new possibilities. I'll have a think around your issue, as a feature request.

Hope this helps.

  • Like 1
Link to comment
Share on other sites

Thanks @kongondo

That makes sense and thanks for confirming. I thought that might be the case but just thought I'd chance my luck! Looking forward to seeing if this makes it into future releases like you mentioned, thanks for considering it as a feature request.

I also posted another question yesterday which relates to this and the use of Dynamic Selects, which might give some other use cases to consider. I had started working with 2 basic page reference fields and using the selector string for the second one almost works, but doesn't appear to be able to get the associated values of fields within the selected page of the first page reference. It looks like I'm out of luck there in terms of avoiding a page refresh with the hook approach.

 

Link to comment
Share on other sites

  • 2 months later...
On 3/29/2020 at 2:18 PM, Maverick said:

Hi guys, 

Does anyone know how to add sorting tot the child selects? The first select can get sorting in the dynamic selects settings, for example sort=name and it works nice, but for some reason it doesn't work for the second and third selects.

I have tried to manually drag and drop the items in the admin for the alphabetical order, I also tried to set all parents sort settings to sort=name but that doesn't move it either. In your example @kongondo you also see this behaviour (frontend dynamic selects example)

Let's say I have Continent, Country, City selects. Under my country select I have USA, Mexico, Argentina. The country pages were added in this order, so 1 USA, 2 Mexico and 3 Argentina. Argentina is always as the last item in the dropdown select (on frontend). If I add Zimbabwe under Country parent, the Zimbabwe will be last in the dropdown select. So it seems that the child drop down selects are always being sorted by creation date? Can this be setup to work in alphabetical order?

Hi guys, 

Does anyone know if the latest version of Dynamic Selects has the possibility to sort the child selects on frontend? So you can sort the items based on name? 

Link to comment
Share on other sites

Hi @Maverick,

Apologies it has taken too long to resolve this. I have now fixed this. All selects are sorted alphabetically both in the back and frontend. If your download link has expired, please let me know so that I can send you the files personally.

Thanks.

  • Like 1
Link to comment
Share on other sites

New Dynamic Selects

Here is a preview of the upcoming update to Dynamic Selects (version 008). It is still early days and I don't currently have an ETA. This upgrade redefines the 'select' in Dynamic Selects. You are no longer tied to this <select></select>.

This upgrade will give developers control over how they would like to have their Dynamic Selects rendered both in the Inputfield and in the frontend. This is possible thanks to htmx and ProcessWire's TemplateFile class. These allow for partial rendering of templates generated server-side. For each Dynamic Selects data type (Page, Template, User, Field), there will be a default partial templates which receive an object of that data type. For instance, a Dynamic Select that wants to render children of a selected page will receive the PageArray containing those children at their partial template. Developers wanting total control of any partial template will only need to duplicate a partial template and save this to a designated folder under /site (similar to Padloper) and customise that as they wish. This opens up a myriad possibilities. Your markup, your way. You want to render a HTML table, fine. An accordion? Fine. A photo gallery? Why not!

The above also means all ProcessWire fields, including custom ones will be supported. This is because the partial template will receive the relevant object. With custom partial templates, this leads to endless possibilities. Repeaters, complex fields, any field. You could even combine this with Padloper to allow your customers to search for or preview products in very creative ways.

Because these new version uses template partials, it means you can employ access controls in any part of the Dynamic Selects , for instance, show different fields or markup depending on user's location or if logged in, etc.

Using the power of htmx, it also means you can output markup to different places simultaneously (Out of Band Swaps). @999design, this could cover your need in your post above about triggering more than 1 select.

 

  • Like 3
Link to comment
Share on other sites

  • 9 months later...
18 hours ago, dotnetic said:

Was version 008 ever released? I bought this module some days ago, and received version 007 (codename James Bond).

Hi @dotnetic. Thanks for the purchase. No; 008 has been delayed. I hit a number of technical design issues so I had to go back to the drawing board. Apologies, I should have updated my post.

 

7 hours ago, dotnetic said:

The reason why I am asking for the release of v008 is because as the initial select I want to display a list of images instead of the title. Is this possible with v007?

It is not possible in 007. I am wondering if a quick fix would be for me to make the render method hookable. You can then swap it in your markup. We could do this on your custom install. Please let me know. Otherwise I still don't have an ETA for 008, sorry.

Link to comment
Share on other sites

  • 3 weeks later...

Hi all,

Dynamic Selects Next/008

Sorry I haven't posted here in a while. 

I am currently thinking about the next version of Dynamic Selects. It will part be refactoring and part be some new (some requested) features. Below are the current plans for the next version. Any other thoughts and/or ideas I should consider? It is a bit of work so I might have to stretch this into several updates (versions). Thanks.

A number of conversations with some of you has led me to realise that DS although useful, is somewhat limiting. Other than the current lack of flexibility to render different types of content, I think there are two fundamental shortcomings of this module.

The first is the concept of relationships. The approach I took when creating the module assumed that selects/columns had to be related, i.e. parent > child; page > field, etc. Whilst this was powerful enough, it didn't always represent real world scenarios. It limited the module to 'relationships' and perhaps forced developers who wanted to use this module to structure their sites in the mold of DS. This is not the ProcessWire way, at least not in terms of flexibility. Consider the following example. Let's say we have a site about buildings. There are some things buildings have in common, e.g. windows, doors, etc. However, some features are peculiar to certain types of buildings. For instance, skyscrapers will have lifts whilst bungalows will not. If we wanted to model this in the frontend, i.e. choose type of buildings, then show what features it has, it would mean we need to use a page reference field for the DS to work. The question is, does it have to be this way? Perhaps this is a contrived example but I think we need to decouple the relationships between columns/selects in DS. Enter actions.

ACTIONS

The next DS will do away with the concept of relationships. Instead, we will adopt the concept of actions. In other words, IF ACTION > THEN do THIS (OR even THESE...see below) > ELSE. This will make the module more flexible and more powerful. User defined action > consequence are much more versatile than the current strict relationship between 'entities' approach. This will allow for setups such as if user selects 'people' [ACTION], THEN get content related to 'people'. ELSE IF [ACTION] 'buildings', THEN get things related to 'buildings', ELSE get some default content. 

Related to  this is the current restriction to only populate the next column/select after a selection in the preceding column. We will change this in the next version, making it configurable and more flexible. For instance, If I select make of a car in the first column, the second and third columns could be populated with brands and year, respectively. 

DEFINING  ACTIONS

The current method of creating dynamic selects is very confusing and a bit complex. Personally I also struggle to remember the relationship types and naming conventions 😄. This has to change. I haven't yet firmed up any ideas but I'd want something this is visually easy to understand and clearly shows the 'IF ACTION THEN THIS ELSE THAT'. Maybe a drag and drop? I am thinking something similar to visual data model builders. Any ideas anyone?

Planned work includes:

New Features

  1. New approach to model selects using 'ACTIONS'.
  2. Easier to use 'DS  Builder'.
  3. Trigger change in 1 or more dependent selects.
  4. Partial templates to render different types of content. These can be overridden by user defined templates, allowing for customisation as needed.
  5. Any other thoughts...?

Refactor

  1. Configurable sorting of results (title, modified, sort, etc.)
  • Like 3
Link to comment
Share on other sites

Hello @kongondo

How about using some node graph libs? See for example: https://github.com/wbkd/awesome-node-based-uis I have no experience with any of them, but a decent JS library like that might do the trick.

Another idea is that you might want to consider not to build any visual aid for the actions based approach but implement a programming library for that. After all, your target audience is developers.

Sure, visual building makes it easy for newcomers to produce results fast, but it will be limiting in the long run. And there is the option to mix the two approaches. Since you are planning to work on the module in iterations, you might want to start with the programming library approach as that should be the bases of the visual aid anyway.

Side note: recently I worked on a complex form and decided to implement some utility classes for handling forms, along with realising dependent selects as well, and I also had to deal with "non-parent/child relationships". (Just don't think of any sort of "library level" coding here, those utility classes are for my own humble needs.)

 

  • Like 1
Link to comment
Share on other sites

Hi @szabesz,

Thanks for chiming in!

10 hours ago, szabesz said:

Another idea is that you might want to consider not to build any visual aid for the actions based approach but implement a programming library for that. After all, your target audience is developers.

Sure, visual building makes it easy for newcomers to produce results fast, but it will be limiting in the long run. And there is the option to mix the two approaches. Since you are planning to work on the module in iterations, you might want to start with the programming library approach as that should be the bases of the visual aid anyway.

Great idea!  I like the mixed approach idea. I'll have a think.

10 hours ago, szabesz said:

How about using some node graph libs? See for example: https://github.com/wbkd/awesome-node-based-uis I have no experience with any of them, but a decent JS library like that might do the trick.

I'll have a look, thanks!

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi @kongondo,

I'm in the process of having to merge 2 Joomla/Seblod sites with several types of 'search' pages. Most of them have a search-box with a combination of dynamic search + one or more input boxes for a text search

In the documentation I couldn't find find any reference to the fact that your module effectively supports a combination of dynamic search + one or more input boxes for text. If it can do what I do as in the link below, I'll buy your module immediatly. 🙂

Hereunder one example, of one type of filtered search page with such a box (text+dynamic), paging and a responding url from a collection with 44000 items: 
https://sincfala.be/museumcollectie/collectie?cck=collectieitems&art_title=&collectienaam=Audiovisuele+materialen&rubrieknaam=Prentbriefkaarten&onderrubrieknaam=Duinbergen&zoek_op_een_trefwoord=hotel&search=collectieitems&task=search

Kind regards,
Bernard

    

 

 

Link to comment
Share on other sites

On 4/19/2023 at 3:08 PM, Pretobrazza said:

I couldn't find find any reference to the fact that your module effectively supports a combination of dynamic search + one or more input boxes for text.

Hi @Pretobrazza,

Currently this is not possible but will be possible with the next version mentioned in this post above.

Best

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hi @kongondo and thanks for this module (I bought some days ago).

I installed it and it worked perfectly since I switched to php 8.
Now I've got 4 deprecated messages and the backend doesn't work anymore.

Deprecated: Required parameter $mode follows optional parameter $value in /site/modules/DynamicSelects/DynamicSelectsRender.php on line 980

Deprecated: Required parameter $action follows optional parameter $items in /site/modules/DynamicSelects/DynamicSelectsActions.php on line 214

Deprecated: Required parameter $action follows optional parameter $items in /site/modules/DynamicSelects/DynamicSelectsActions.php on line 317

Deprecated: Required parameter $action follows optional parameter $items in /site/modules/DynamicSelects/DynamicSelectsActions.php on line 415

 

Link to comment
Share on other sites

Hi @nabo,

Many thanks for the purchase!

1 minute ago, nabo said:

since I switched to php 8.
Now I've got 4 deprecated messages and the backend doesn't work anymore.

I'll work on these; the fixes seem straightforward enough. I'll send you the updated files for testing and look to make an official release for later in the year. I hope this is OK. Thanks!

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Hi @kongondo,

I was looking at the progress you have made on this product... I have an idea that I was looking to implement on the backend but realized dynamic selects might already cover it.

I saw way up in the thread that Repeater and RepeaterMatrix were supported, but I am assuming this means you can include Dynamic Select fields in Repeater items, not that repeaters are able to be polled in the dynamic field definition processes?

So for example, I have a page with template gallery and It's called gallery. It's got a repeater/repeater matrix called shows. It has a repeater item for each show.

Could I generate a dynamic select that runs like:

Roma Gallery -> Shows -> #1 - Pottery in Venice (following the default display list format for the repeater)

Page -> Repeater Field -> Repeater(Matrix) Rows

Or even recursively polling repeaters? Lol. Maybe not too crazy.

This is sort of hypothetical - I have another way to handling the issue if I must, but is this something you'd consider or have already considered as a feature?

Thanks!

  • Like 1
Link to comment
Share on other sites

On 11/13/2023 at 6:17 PM, gornycreative said:

I was looking at the progress you have made on this product... I have an idea that I was looking to implement on the backend but realized dynamic selects might already cover it.

Hi @gornycreative,

I have been away so just picking up messages now. Thanks for your interest in Dynamic Selects. I'll respond to your questions ASAP. There might be a delay as I settle in after a long absence, thanks.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...