Skip to content

Commit

Permalink
Added some more documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Green authored Aug 3, 2016
1 parent bd18dc4 commit 869a7c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion javascript/limit-number-of-repeat-groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function js_limit_group_repeat( $post_id, $cmb ) {
jQuery(document).ready(function($){
// Only allow 3 groups
var limit = <?php echo $limit; ?>;
var fieldGroupId = '_cmb2_repeat_group';
var fieldGroupId = '_cmb2_repeat_group'; // This should match the ID of your group field.
var $fieldGroupTable = $( document.getElementById( fieldGroupId + '_repeat' ) );

var countRows = function() {
Expand Down Expand Up @@ -84,4 +84,6 @@ function js_limit_group_repeat( $post_id, $cmb ) {
</script>
<?php
}
// Replace `field_group_test` with the ID of the CMB2 meta box in question e.g. this
// should match the value of $cmb->id in the above example.
add_action( 'cmb2_after_post_form_field_group_test', 'js_limit_group_repeat', 10, 2 );

0 comments on commit 869a7c3

Please sign in to comment.