List -SubList- Sub-Sub-List conditional logic and display with CMB2
-
Despite good documentations and plenty of examples, I feel that its still hard for me to get this done working since there is no example for this kind of logic I could find. So I decided to post this question after plenty of my dabbling with cmb2.
I am trying to create a dependent field drop downs that has the simple logic of dependencies between the fields. How do I get the selected value of first field in the second field dynamically ? Also how do I make them conditionally dependent, i.e. when one selection changes then all the children change too.
I am using front end form from the snippets lib,
1. Form: front-end-post-form
2. Field 1: Parent List$cmb->add_field ( array ( 'name' => 'Test Select Field', 'desc' => 'Select an option', 'id' => 'wiki_test_select_field',...
3. Field 2: Sub-List.
$cmb->add_field ( array ( 'name' => 'Test Select Sub List', 'desc' => 'Select an option', 'id' => 'wiki_test_select_sublist', 'type' => 'select', 'show_option_none' => false, 'default' => 'custom', 'options_cb' => 'cmb2_get_sublist_options', ) ); function cmb2_get_sublist_options() { $parent_id = cmb2_get_field_value( 'front-end-post-form', 'wiki_test_select_field', get_queried_object_id() );
The last function always gives me the static default value of the field and not the selected value.
- The topic ‘List -SubList- Sub-Sub-List conditional logic and display with CMB2’ is closed to new replies.