Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Justin Sternberg
@jtsternberg
What kind of help?
Juan Rangel
@JuanRangel
I am trying to conditionally show a setup of fields depending on the value of the select box. So I created a select field with my options and using JS I hide all other fields in that metabox. I then use a switch case block to show the necessary fields. This is inside of a repeating field.
The issue I am having is this; I show the fields using .on('change') so when the page loads all fields are hidden until the select box is changed. Also when I add a new repeater block the .on(change) has no effect.
James DiGioia
@mAAdhaTTah
got a full code example? you might need to add event bindings to the newly added repeater block
Juan Rangel
@JuanRangel
I'd really appreciate if anyone can help me out. I can send some $$ via paypal.
Justin Sternberg
@jtsternberg
.on events won't work if you're attaching them to selectors which get injected to the Dom. E.g. $('.selector-which-gets-added').on( 'event' won't work, but $('body').on( 'event', '.selector-which-gets-added' should.
James DiGioia
@mAAdhaTTah
also you dont need to keep passing your variables into the jquery selector, they're already jquery objects
lines 4,5 & 6 can just be module.find
cggit
@cggit
is there a built in way to get group styles without repeater support? I want all my cmb2 cpt fields to look like they're in one metabox.
cggit
@cggit
my bad I got it
Justin Sternberg
@jtsternberg
Was just about to respond. Nice.
cggit
@cggit
ha thanks anyways.
Juan Rangel
@JuanRangel
Hey Fellas, I am still having the same issues on customizing the conditional logic. If someone wouldn't mind helping me out via skype or something I can send some $$ via paypal. Im asking here because we are all familiar with CMB2.
cggit
@cggit
Is it recommended to setup all fields with one hook to cmb2_init or is it fine to break up logical groups with multiple cmb2_init hooks?
Justin Sternberg
@jtsternberg
@cggit I prefer to break them up. You can actually see them broken up in the example-functions.php file
Juan Rangel
@JuanRangel
I did a tutorial using CMB2 for GenesisCamp today. Just wanted to let you know @jtsternberg https://www.youtube.com/watch?v=Pj3ODB9ENrs
Justin Sternberg
@jtsternberg
@JuanRangel nice! This is somewhat similar to the wpsessions session I did, http://wpsessions.com/sessions/custom-meta-and-settings-with-cmb2/
It's a good resource
Juan Rangel
@JuanRangel
I watched that live and ordered the video as well. :-)
Scott Kingsley Clark
@sc0ttkclark
@jtsternberg anything you can point me to in terms of direction on best way to help you guys rewrite the repeater field into backbone or whatever so there can be multiple repeaters on the same page / repeaters in repeaters? or are those working now?
Justin Sternberg
@jtsternberg
@sc0ttkclark they are not working yet, and I don't believe Camden ever started on it. I honestly don't think there will be too much to fix there, because it seems that the jQuery selectors are just too greedy
Scott Kingsley Clark
@sc0ttkclark
so, best way forward -- any way you or Camden can walk me through it so i can put time into it?
we absolutely need it to move forward with Pods 3.0 + CMB2
Scott Kingsley Clark
@sc0ttkclark
so it's a priority for me, although i may pass it on to another person on our team, i should be versed in it so i can divvy up tasks as necessary
maybe there's a github issue for it too
and i was wondering if that was the block of code that needed tweaking
Justin Sternberg
@jtsternberg
Yah, addAjaxRow and addGroupRow are probably the culprits. I'm super-slammed since I was out of town this week, but best bet would be to add multiple repeat groups to a page and see how it breaks.. I think that will help narrow it down. I'd fix that problem first, and see if it fixes the repeat groups w/in repeat groups problem
Scott Kingsley Clark
@sc0ttkclark
ok, thx, i'll try going through that and see what i can do
that person who posted the CMB2 admin UI plugin, i tested that code and saw it affecting that, so i might just use that as a quick and easy way to test / fix
Justin Sternberg
@jtsternberg
ok, sorry I can't do more. Maybe we could setup a call next week if it would be helpful? But as of right now, that's all I know
Was that Marcus? the admin UI plugin?
Scott Kingsley Clark
@sc0ttkclark
sure, ping me if you get some time next week, i'll be around
Justin Sternberg
@jtsternberg
Ah that's right
ok
Scott Kingsley Clark
@sc0ttkclark
@twoelevenjay i installed it, but plugins disappeared immediately although i'm an admin, not sure what happened, but once i forced is_cmb2_allowed to return true, then went to settings, added my user 'admin' and removed my forced return true and that resolved it
Scott Kingsley Clark
@sc0ttkclark

some other issues currently, some php notices:

Notice: Undefined variable: field_options in /srv/www/wordpress-default/wp-content/plugins/cmb2-admin-extension/includes/class-meta-box-post-type.php on line 580

Notice: Undefined index: _cmb2_options_textarea in /srv/www/wordpress-default/wp-content/plugins/cmb2-admin-extension/includes/class-meta-box-post-type.php on line 556

Notice: Undefined index: _cmb2_decription_textarea in /srv/www/wordpress-default/wp-content/plugins/cmb2-admin-extension/includes/class-meta-box-post-type.php on line 577

Notice: Undefined variable: field_options in /srv/www/wordpress-default/wp-content/plugins/cmb2-admin-extension/includes/class-meta-box-post-type.php on line 580

Scott Kingsley Clark
@sc0ttkclark
ah, thought this one did groups but doesn't look like it, that's fine though
i'll try a custom implementation
Scott Kingsley Clark
@sc0ttkclark
there we go
i can see it clearly now, the rain is gone
Scott Kingsley Clark
@sc0ttkclark
@jtsternberg when you get a second, is this valid for adding group fields to group fields? http://sc0tt.me/image/2k0c2G1x3C38/Screen%20Shot%202015-07-24%20at%201.42.49%20PM.png
seems like valid syntax to me
but before i go down the hole, best to know if it's right or not
because i'm seeing empty rows with no fields output here for the tracks, just add/remove
i suspect it's more than just a JS issue
Scott Kingsley Clark
@sc0ttkclark
i see now add_group_field returns an array:
return array( $parent_field_id, $field['id'] );