Form Generator and Select List based on Filter

5 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 10   (RSS)

By kitsguru - June 1

In  my Section Editor I have a pull down list that uses advanced mySQL based on a filter. Specifically province filtered by country.

Is there a way to add this to the Form Generator Plugin?

Jeff Shields

By daniel - June 9

Hi Jeff,

Unfortunately, the Form Generator Plugin doesn't currently support the Advanced Filter option, though I can note that it's a desired feature.

It would be possible to manually add it to the form after it has been generated, but this would require some custom programming. If you'd like to attempt to do so I could point you to the relevant code sections that add support for it in the CMSB admin, or if you'd like some assistance we'd be happy to provide an estimate for the work: https://www.interactivetools.com/estimate/

Thanks!

Daniel
Technical Lead
interactivetools.com

By kitsguru - June 9

just point me in the right direction, I can take it from there

Jeff Shields

By daniel - June 10

Hi Jeff,

Sure thing!

  • The JS trigger that attaches to the parent select field can be found near the end of /cmsb/lib/fieldtypes/list.php between lines 172-178 - it calls the JS function updateListFieldOptions()
  • updateListFieldOptions() can be found in /cmsb/lib/menus/default/edit_functions.js on line 193. This runs an AJAX call to fetch the new filtered results from ajaxUpdateListFieldOptions()
  • ajaxUpdateListFieldOptions() can be found in /cmsb/lib/menus/default/actionHandler.php on line 89.

As this functionality is set up to specifically work in the CMSB admin, it may reference some values that aren't generated by default with the Form Builder plugin, but these code sections should broadly contain what's necessary to create a manual implementation.

Let me know if you have any questions about what you find!

Thanks,

Daniel
Technical Lead
interactivetools.com