Title: CMB2 custom conditional implementation
Last modified: November 13, 2020

---

# CMB2 custom conditional implementation

 *  Resolved [Wildcard](https://wordpress.org/support/users/thenewguy_14/)
 * (@thenewguy_14)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/cmb2-custom-conditional-implementation/)
 * Hey so I am trying a custom implementation of cmb2 conditional stuff because 
   the plugins out there don’t work for every field and I have a custom theme that
   I use with cmb2 tied into it.
 * But basically I just wrap fields and group rows with a div that has a class of
   field-wrapper and a class from the select box that has different layout names.
 * So you choose a layout and the jQuery finds the field-wrappers with that class
   and shows them and hides the rest.
 * Works great for the first group row but when you add a new row the console will
   log the select box change but won’t show the group rows or fields when the select
   box is changed. And if you change the select box then update the page the correct
   row or fields show and then you can change the select box again and it changes
   the rows and fields again. So its almost like you have to lock in the new group
   row to the database for the jQuery to recognize it. Is there away to trigger 
   an ajax save so that the new rows get recognized?
 * Disclaimer: I have taught myself a lot of programming stuff and maybe I just 
   am missing something small like maybe the DOM doesn’t register elements that 
   are display none or something else but I am just looking for a little guidance
   on how i can get this to work so that when I had my theme over to other developers
   it will work the right way. Any help would be awesome and I can send over the
   jQuery file and page layout cmb2 file if you are will to look into it. Any help
   would be awesome
    -  This topic was modified 5 years, 6 months ago by [Wildcard](https://wordpress.org/support/users/thenewguy_14/).

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [5 years, 6 months ago](https://wordpress.org/support/topic/cmb2-custom-conditional-implementation/#post-13660548)
 * Best we have at the moment is the links/extensions from others found over at 
   [https://github.com/CMB2/CMB2/issues/1381](https://github.com/CMB2/CMB2/issues/1381)
   where I believe you also commented and chimed in on.
 * CMB2 core doesn’t have anything for conditional-ness out of box.

Viewing 1 replies (of 1 total)

The topic ‘CMB2 custom conditional implementation’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)

 * 1 reply
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/cmb2-custom-conditional-implementation/#post-13660548)
 * Status: resolved