Dynamically field selection to filter another dynamic field?

By: Michael M | Asked: 07/12/2023
ForumsCategory: Code HelpDynamically field selection to filter another dynamic field?
Michael M asked 1 year ago

I have a single form with two dynamic fields, both "dynamically created from your taxonomy"

First dynamic field (A) is a radio button with two choices

Second dynamic field (B) is a checkbox list  

 

I'd like the items in B to be adjusted (set / unset) according to the choice in A.  (with immediate/AJAX update, not just on submit).

So depending on the choice in A, the user could only select certain of the options in B.  

 

Found a hook "frm_setup_new_fields_vars" that allows adjusting the B options, but only when the form loads. Not when field A is clicked / changed.

Maybe I need a hook that provides "on change" events for A, but couldn't find that, so think I'm looking with the wrong search terms :D 

The conditional logic only seems to allow an entire dynamic field to show/hide based on A, and only at form load or page change. Is there a way to handle such a situation ?          

1 Answers
Victor Font answered 1 year ago
There is no hook for an "on change" event. "On change" events in real time require jQuery Ajax. You need to write custom jQuery code as well as the PHP function to process the data and return values. If you've never written for Ajax before, it's a lot to learn. You also have to know how to use JSON. It may be useful to consult with a developer: https://formidable-masterminds.com/developers-directory/
Michael M replied 1 year ago

Thanks. I'm happy to implement something with jQ. Now you've kindly confirmed the function doesn't exist in FF, that's exactly what I'll do!

Really appreciate your constant help and "voice of experience" at these forums Victor.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right