Script errors when upgrading from metabox 4.5 > 4.8
- This topic has 8 replies, 2 voices, and was last updated 8 years, 9 months ago by
MikeTrebilcock.
-
AuthorPosts
-
June 13, 2016 at 8:38 PM #3443
MikeTrebilcock
ParticipantHi,
Having issues upgrading from metabox 4.5 to 4.8 this is the error:load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 Uncaught Error: Syntax error, unrecognized expression: #course_cluster[] fa.error @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 fa.tokenize @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 fa.select @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2fa @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 n.fn.extend.find @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 a.fn.find @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:9 n.fn.init @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 a.fn.init @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:9n @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2(anonymous function) @ validate.js?ver=4.8.7:29 n.extend.each @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 (anonymous function) @ validate.js?ver=4.8.7:25n.extend.each @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 n.fn.n.each @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 (anonymous function) @ validate.js?ver=4.8.7:19i @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 j.fireWith @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2 n.extend.ready @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2K @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5.2:2
Seems to be referring to plupload but not sure where to start, if i roll it back to 4.5 everything is fine.
I am using group and conditional logic extensions. on WordPress 4.5.2
any help or pointers would be greatly appreciated
ThanksJune 14, 2016 at 10:55 AM #3447Anh Tran
KeymasterCan you post the code you use to register meta boxes and custom fields?
June 14, 2016 at 4:11 PM #3449MikeTrebilcock
ParticipantSorry this is going to be quite a chunk of code....
<?php add_filter( 'rwmb_meta_boxes', 'course_register_meta_boxes' ); function course_register_meta_boxes( $meta_boxes ) { $prefix = 'course_'; // Course types set by slug $he = get_term_by('slug', 'he', 'course_type'); $he = $he->term_id; $fe16_18 = get_term_by('slug', 'fe16_18', 'course_type'); $fe16_18 = $fe16_18->term_id; $fe19plus = get_term_by('slug', 'fe19plus', 'course_type'); $fe19plus = $fe19plus->term_id; $b2b = get_term_by('slug', 'b2b', 'course_type'); $b2b = $b2b->term_id; $apprentice = get_term_by('slug', 'apprentice', 'course_type'); $apprentice = $apprentice->term_id; $alc = get_term_by('slug', 'alc', 'course_type'); $alc = $alc->term_id; $meta_boxes[] = array( 'id' => 'he_subtitle', 'title' => __( 'Sub-Title'), 'post_types' => 'courses', 'priority' => 'high', 'autosave' => true, 'context' => 'side', 'visible' => array('course_type_select', 'in', "{$he},{$fe19plus},{$fe16_18}"), 'fields' => array( // Course referance code array( 'name' => __( '' ), 'id' => "{$prefix}he_subtitle", 'desc' => __( 'HE sub-title (Year of entry) or Subsidiary title for FE Courses' ), 'type' => 'text', ), ), ); // course type $meta_boxes[] = array( 'title' => __( 'Course Type'), 'post_types' => 'courses', 'context' => 'side', 'post_types' => 'courses', 'priority' => 'high', 'autosave' => true, 'fields' => array( // COURSE TYPE CHECKBOX LIST array( 'name' => __( ''), 'id' => "{$prefix}type_select", 'type' => 'taxonomy', 'required' => true, 'taxonomy' => 'course_type', 'field_type' => 'select_advanced', 'js_options' => array( 'multiple' => true, ), 'multiple' => true, ), //KIS code array( 'name' => __( 'KIS CODE', 'kis_code' ), 'id' => "{$prefix}kis_code", 'visible' => array('course_type_select', 'in', "{$he}"), 'type' => 'number', ), //KIS institution code array( 'name' => __( 'KIS institution CODE' ), 'id' => "{$prefix}kis_institution_code", 'visible' => array('course_type_select', 'in', "{$he}"), 'type' => 'number', ), //UCAS Course Code array( 'name' => __( 'UCAS Course CODE' ), 'id' => "{$prefix}ucas_course_code", 'visible' => array('course_type_select', 'in', "{$he}"), 'type' => 'text', 'attributes' => array( 'maxlength' => 4, ), ), //UCAS institution code array( 'name' => __( 'UCAS Institution CODE' ), 'id' => "{$prefix}ucas_institution_code", 'type' => 'select', 'visible' => array('course_type_select', 'in', "{$he}"), 'placeholder' => __( 'Please select...' ), 'options' => array( 'B18' => __( 'Bicton College (Plymouth)', '' ), 'CORN C78' => __( 'Cornwall College', '' ), 'DUCHY D55' => __( 'Duchy College', '' ), ), ), //HE Course FEES array( 'name' => __( 'Course Fee', 'he_course_fee' ), 'id' => "{$prefix}he_course_fee", 'type' => 'number', 'desc' => __( '(per annum)' ), 'visible' => array('course_type_select', 'in', "{$he}"), 'attributes' => array( ), ), ), ); //Course structure in the sidebar $meta_boxes[] = array( 'id' => 'course_structure', 'title' => __( 'Course Structure', 'course_structure' ), 'post_types' => 'courses', 'context' => 'side', 'priority' => 'low', 'autosave' => true, 'fields' => array( // Course referance code array( 'name' => __( 'Course Reference Code', 'ref_code' ), // Field ID, i.e. the meta key(prefixed with course_) 'id' => "{$prefix}ref_code", 'desc' => __( 'Course reference code' ), 'type' => 'text', ), // learning area TAXONOMY array( 'name' => __( 'Learning Area:' ), 'id' => "{$prefix}cluster", 'type' => 'taxonomy', 'taxonomy' => 'cluster', 'field_type' => 'select_advanced', 'query_args' => array(), 'js_options' => array( 'multiple' => true, ), 'multiple' => true, 'placeholder' => 'Select area...', ), // Level TAXONOMY array( 'name' => __( 'Course Level', 'level' ), 'id' => "{$prefix}level_taxonomy", 'type' => 'taxonomy', 'required' => true, 'field_type' => 'select', 'taxonomy' => 'level', 'query_args' => array(), ), //Campus TAXONOMY array( 'name' => __( 'This course is avalible at:', 'campuses' ), 'id' => "{$prefix}campuses", 'type' => 'taxonomy', 'taxonomy' => 'campus', 'field_type' => 'select_advanced', 'js_options' => array( 'multiple' => true, ), 'multiple' => true, 'query_args' => array(), ), // brand TAXONOMY array( 'name' => __( 'Course Brand(s):', 'brands' ), 'id' => "{$prefix}brands", 'type' => 'taxonomy', 'taxonomy' => 'brand', 'field_type' => 'select_advanced', 'js_options' => array( 'multiple' => true, ), 'multiple' => true, 'query_args' => array(), ), array( 'name' => __( ''), 'id' => "{$prefix}trail_blazer", 'type' => 'radio', 'visible' => array('course_type_select', 'in', "{$apprentice}"), 'options' => array( 'true' => 'Trail Blazer' ), ), ), // VALIDATION ========================================================================================================= 'validation' => array( 'rules' => array( "{$prefix}ref_code" => array( 'required' => true, ), "{$prefix}cluster[]" => array( 'required' => true, ), "{$prefix}level_taxonomy[]" => array( 'required' => true, ), "{$prefix}campuses[]" => array( 'required' => true, ), "{$prefix}brands[]" => array( 'required' => true, ), ), // optional override of default jquery.validate messages 'messages' => array( "{$prefix}master_code" => array( 'required' => __( 'Course Master Code is required', 'master_code' ), ), "{$prefix}cluster[]" => array( 'required' => __( 'A Learning Area is required', 'cluster' ), ), "{$prefix}level_taxonomy[]" => array( 'required' => __( 'Course Level is required', 'level_taxonomy' ), ), "{$prefix}campuses[]" => array( 'required' => __( 'A Campus is required' ), ), "{$prefix}brands[]" => array( 'required' => __( 'A brand is required' ), ), ) ) ); $meta_boxes[] = array( 'id' => 'course_info_area', 'title' => __( 'Course Information' ), 'post_types' => 'courses', 'priority' => 'high', 'autosave' => true, //'context' => 'side', 'hidden' => array('course_type_select', 'in', "{$he},{$alc}"), 'fields' => array( //Ideal if.. array( 'name' => __( 'Ideal if', 'ideal_if' ), 'id' => "{$prefix}ideal_if", 'type' => 'wysiwyg', 'desc' => 'Summary of what you get', 'hidden' => array('course_type_select', 'in', "{$apprentice}"), 'raw' => false, 'options' => array( 'textarea_rows' => 4, 'teeny' => true, 'media_buttons' => false, ), ), // will need... array( 'name' => __( 'Will Need', 'will_need' ), 'id' => "{$prefix}will_need", 'type' => 'wysiwyg', 'desc' => 'Entry requirements', 'raw' => false, 'options' => array( 'textarea_rows' => 4, 'teeny' => true, 'media_buttons' => false, ), ), // will learn... array( 'name' => __( 'Will Learn', 'will_learn' ), 'id' => "{$prefix}will_learn", 'type' => 'wysiwyg', 'desc' => 'List of core topics and skills', 'raw' => false, 'options' => array( 'textarea_rows' => 4, 'teeny' => true, 'media_buttons' => false, ), ), // expect... array( 'name' => __( 'Expect', 'expect' ), 'id' => "{$prefix}expect", 'type' => 'wysiwyg', 'desc' => 'This is a chance to talk about the learning experience and structure', 'hidden' => array('course_type_select', 'in', "{$apprentice}"), 'raw' => false, 'options' => array( 'textarea_rows' => 4, 'teeny' => true, 'media_buttons' => false, ), ), // will love... array( 'name' => __( 'Will Love', 'will_love' ), 'id' => "{$prefix}will_love", 'type' => 'wysiwyg', 'desc' => 'Any course spercific selling points', 'hidden' => array('course_type_select', 'in', "{$apprentice}"), 'raw' => false, 'options' => array( 'textarea_rows' => 4, 'teeny' => true, 'media_buttons' => false, ), ), // go to... array( 'name' => __( 'Go On To', 'go_to' ), 'id' => "{$prefix}go_to", 'type' => 'wysiwyg', 'desc' => 'Progression routes', 'raw' => false, 'options' => array( 'textarea_rows' => 4, 'teeny' => true, 'media_buttons' => false, ), ), //go to (course progression select) array( 'name' => __( 'Progression Courses' ), 'id' => "{$prefix}progression", 'type' => 'post', 'post_type' => 'courses', // Field type, either 'select' or 'select_advanced' (default) 'field_type' => 'select_advanced', 'placeholder' => __( 'Select a course' ), // Query arguments (optional). No settings means get all published posts 'query_args' => array( 'post_status' => 'publish', 'posts_per_page' => - 1, ), 'clone' => true, ), ), ); //Similar courses to this one (course select) $meta_boxes[] = array( 'title' => __( 'Similar courses to this one' ), 'post_types' => 'courses', 'context' => 'normal', 'priority' => 'low', 'fields' => array( array( 'name' => __( 'Select a similar course' ), 'id' => "{$prefix}similar_courses", 'type' => 'post', 'post_type' => 'courses', // Field type, either 'select' or 'select_advanced' (default) 'field_type' => 'select_advanced', 'placeholder' => __( 'Select a course' ), // Query arguments (optional). No settings means get all published posts 'query_args' => array( 'post_status' => 'publish', 'posts_per_page' => - 1, ), 'clone' => true, ), ), ); // Course Video Gallery $meta_boxes[] = array( 'title' => __( 'Course Video Gallery' ), 'post_types' => 'courses', 'context' => 'normal', 'priority' => 'low', 'fields' => array( // OEMBED array( 'name' => __( 'oEmbed', 'your-prefix' ), 'id' => "{$prefix}video_gallery", 'desc' => __( 'paste your embed code to link videos' ), 'type' => 'oembed', 'clone' => true, ), ), ); // Course image gallery upload // PLUPLOAD IMAGE UPLOAD (WP 3.3+) $meta_boxes[] = array( 'title' => __( 'Course Gallery', 'gallery' ), 'post_types' => 'courses', 'context' => 'normal', 'priority' => 'low', 'fields' => array( array( 'name' => __( '', 'course-gallery' ), 'id' => "{$prefix}plupload", 'type' => 'plupload_image', 'desc' => __( 'File Size 1mb MAX' ), 'max_file_uploads' => 10, ), ) ); // Course start date and location group $meta_boxes[] = array( 'title' => __( 'Course Offering Dates', 'course_offerings' ), 'post_types' => 'courses', 'context' => 'normal', 'priority' => 'low', 'fields' => array( // Group array( //'name' => 'Start Dates', // Optional 'id' => 'course_offering', 'type' => 'group', 'clone' => true, 'sort_clone' => true, // List of sub-fields 'fields' => array( //offering title array( 'name' => __( 'Offering Title', 'offering_title' ), 'id' => "{$prefix}offering_title", 'type' => 'text', ), // Course offering code array( 'name' => __( 'Course Offering Code', 'offer_code' ), // Field ID, i.e. the meta key(prefixed with course_) 'id' => "{$prefix}offer_code", 'desc' => __( 'Course offering code' ), 'type' => 'text', 'required' => true, ), // Long course (September start with current year) array( 'name' => esc_html__( 'Long Course with September Start' ), 'id' => "{$prefix}long_course", 'type' => 'checkbox', 'desc' => __( 'Tick this if this offer has a Septmber start every Year (this will remove start and end date options)' ), // Value can be 0 or 1 'std' => 0, ), //offering start date array( 'name' => __( 'Course Start Date', 'course_start_date' ), 'id' => "{$prefix}date", 'type' => 'date', 'required' => true, 'visible' => array("{$prefix}long_course", false), // jQuery date picker options. See here http://api.jqueryui.com/datepicker 'js_options' => array( 'appendText' => __( '(dd-mm-yyyy)' ), 'dateFormat' => __( 'dd-mm-yy' ), 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true, ), ), //offering campus location array( 'name' => __( 'This course is avalible at:', 'offering_campuses' ), 'id' => "{$prefix}offering_campus", 'required' => true, 'type' => 'taxonomy', 'options' => array( // Taxonomy name 'taxonomy' => 'campus', // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional 'type' => 'select', 'id' => "offering_campus", // Additional arguments for get_terms() function. Optional 'args' => array() ), ), //course duration array( 'name' => __( 'Duration', 'your-prefix' ), 'id' => "{$prefix}duration", // Field description (optional) 'desc' => __( 'e.g. 3 day course', 'duration' ), 'type' => 'text', 'required' => true, // Default value (optional) //'std' => __( 'Default text value', 'duration' ), // CLONES: Add to make the field cloneable (i.e. have multiple value) ), // off site? array( 'name' => __( 'This course is off site?', 'off_site_check' ), 'id' => "{$prefix}off_site_check", 'type' => 'checkbox', 'std' => 0, ), // days of the week !*--FE, ALC ONLY--*! array( 'name' => __( 'Day(s) of the week', 'course_days_of_week' ), 'id' => "course_days_of_week", 'visible' => array('course_type_select', 'in', "{$fe19plus},{$alc}"), 'type' => 'checkbox_list', 'std' => 0, // Options of checkboxes, in format 'value' => 'Label' 'options' => array( 'mon' => __( 'Monday'), 'tue' => __( 'Tuesday'), 'wed' => __( 'Wednesday'), 'thu' => __( 'Thursday'), 'fri' => __( 'Friday'), 'sat' => __( 'Saturday'), ), ), // Course Start TIME !*--FE, ALC ONLY--*! array( 'name' => __( 'Course Start Time' ), 'id' => $prefix . 'start_time', 'visible' => array('course_type_select', 'in', "{$fe19plus},{$alc}"), 'type' => 'time', // jQuery datetime picker options. // For date options, see here http://api.jqueryui.com/datepicker // For time options, see here http://trentrichardson.com/examples/timepicker/ 'js_options' => array( 'stepMinute' => 5, 'showSecond' => true, 'stepSecond' => 10, ), ), // Course End TIME !*--FE ONLY--*! array( 'name' => __( 'Course End Time' ), 'id' => $prefix . 'end_time', 'visible' => array('course_type_select', 'in', "{$fe19plus},{$alc}"), 'type' => 'time', // jQuery datetime picker options. // For date options, see here http://api.jqueryui.com/datepicker // For time options, see here http://trentrichardson.com/examples/timepicker/ 'js_options' => array( 'stepMinute' => 5, 'showSecond' => true, 'stepSecond' => 10, ), ), // DIVIDER array( 'type' => 'divider', 'id' => 'fake_divider_id', // Not used, but needed ), // Additional Information array( 'name' => __( 'Additional Information' ), 'desc' => __( 'Extra course information about this offering' ), 'id' => "{$prefix}add-offer-info", 'type' => 'textarea', 'cols' => 20, 'rows' => 4, ), // DIVIDER array( 'type' => 'divider', 'id' => 'fake_divider_id', // Not used, but needed ), //course cost for ALC array( 'name' => __( 'Course Cost' ), 'id' => "{$prefix}offer_cost", 'type' => 'number', 'desc' => __( 'enter a course cost in pounds (30.50)you DO NOT PREPEND with £', 'duration' ), 'visible' => array('course_type_select', 'in', "{$alc}"), 'min' => 0, 'step' => 5, ), // Map requires at least one address field (with type = text) array( 'id' => 'address', 'name' => __( 'Address', 'your-prefix' ), 'type' => 'text', 'std' => __( 'Trevenson Rd, Pool, Redruth, Cornwall TR15 3PG, UK', 'map' ), 'visible' => array("off_site_check", true) ), array( 'id' => 'map', 'name' => __( 'Location'), 'type' => 'map', // Default location: 'latitude,longitude[,zoom]' (zoom is optional) //'std' => '-6.233406,-35.049906,15', // Name of text field where address is entered. Can be list of text fields, separated by commas (for ex. city, state) 'address_field' => 'address', 'visible' => array("off_site_check", true) ), ), ), ) ); /* HE COURSE Module information WYSIWYG */ $meta_boxes[] = array( 'id' => 'he_area', 'title' => __( 'HE Course Information', 'he_area' ), 'post_types' => 'courses', 'priority' => 'low', 'autosave' => true, //'context' => 'side', 'visible' => array('course_type_select', 'in', "{$he}"), 'fields' => array( // HE Module Information array( 'name' => __( 'HE Entry Requirements' ), 'id' => "{$prefix}he_entry_requirements", 'type' => 'wysiwyg', //'desc' => 'List of modules', // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save 'raw' => false, // Editor settings, see wp_editor() function: look4wp.com/wp_editor 'options' => array( 'textarea_rows' => 10, 'media_buttons' => false, ), ), // DIVIDER array( 'type' => 'divider', 'id' => 'fake_divider_id', // Not used, but needed ), // Group array( 'name' => 'Module Information', 'id' => 'module_information', 'type' => 'group', 'clone' => true, 'sort_clone' => true, // List of sub-fields 'fields' => array( array( 'name' => 'Module Group Title', 'desc' => 'Year/Options etc.', 'id' => $prefix . 'module_group_title', 'type' => 'text', ), array( 'name' => __( 'Module Details' ), 'id' => "{$prefix}he_module_detail", 'type' => 'wysiwyg', 'desc' => 'List of modules', // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save 'raw' => false, // Editor settings, see wp_editor() function: look4wp.com/wp_editor 'options' => array( 'textarea_rows' => 6, 'media_buttons' => false, ), ), ), ), // DIVIDER array( 'type' => 'divider', 'id' => 'fake_divider_id', // Not used, but needed ), // HE Progression Courses array( 'name' => __( 'Progression Courses' ), 'id' => "{$prefix}he_progression", 'visible' => array('course_type_select', 'in', "{$he}"), 'type' => 'post', // Post type 'post_type' => 'courses', // Field type, either 'select' or 'select_advanced' (default) 'field_type' => 'select_advanced', 'placeholder' => __( 'Select a course' ), // Query arguments (optional). No settings means get all published posts 'query_args' => array( 'post_status' => 'publish', 'posts_per_page' => - 1, ), 'clone' => true, ), // DIVIDER array( 'type' => 'divider', 'id' => 'fake_divider_id', // Not used, but needed ), // Awarding University array( 'name' => __( 'Awarding University', 'awarding_uni' ), 'id' => "{$prefix}awarding_uni", 'type' => 'taxonomy', 'options' => array( // Taxonomy name 'taxonomy' => 'awarding_uni', // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional 'type' => 'select', 'id' => "awarding_uni", // Additional arguments for get_terms() function. Optional 'args' => array() ), 'visible' => array('course_type_select', 'contains', "{$he}"), ), // DIVIDER array( 'type' => 'divider', 'id' => 'fake_divider_id', // Not used, but needed ), // COURSE DOCS FILE UPLOAD array( 'name' => __( 'HE Course Documents' ), 'id' => "{$prefix}he_file", 'type' => 'file', ), // DIVIDER array( 'type' => 'divider', 'id' => 'fake_divider_id', // Not used, but needed ), //Research Docs Group array( 'name' => 'Research Documents', 'id' => "{$prefix}research_documents", 'type' => 'group', 'clone' => true, 'sort_clone' => true, // List of sub-fields 'fields' => array( array( 'name' => __( 'Research Introduction' ), 'id' => "{$prefix}research_intro", 'type' => 'wysiwyg', // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save 'raw' => false, // Editor settings, see wp_editor() function: look4wp.com/wp_editor 'options' => array( 'textarea_rows' => 6, 'media_buttons' => false, ), ), // Research DOCS FILE UPLOAD array( 'name' => __( 'Research File Upload' ), 'id' => "{$prefix}research_file", 'type' => 'file_advanced', ), ), ), ) ); // Staff/student/alumni Profile $meta_boxes[] = array( 'title' => __( 'Staff/Student/Alumni Profile', 'course_profile' ), 'post_types' => 'courses', 'context' => 'normal', 'priority' => 'low', 'fields' => array( // POST array( 'name' => __( 'Select Profile' ), 'id' => "{$prefix}profile_post", 'type' => 'post', // Post type 'post_type' => 'profiles', 'clone' => true, // Field type, either 'select' or 'select_advanced' (default) 'field_type' => 'select_advanced', 'placeholder' => __( 'Select a Profile' ), 'desc' => 'Select a staff or student profile from the list to attach it to this course', // Query arguments (optional). No settings means get all published posts 'query_args' => array( 'post_status' => 'publish', 'posts_per_page' => - 1, ) ), ) ); //Student/employer quote (clone) $meta_boxes[] = array( 'title' => __( 'Student/Employer Quote', 'course_quote' ), 'post_types' => 'courses', 'context' => 'normal', 'priority' => 'low', 'fields' => array( array( 'name' => __( 'Quote text', 'quote' ), 'desc' => __( 'Student/employer quote', 'quote' ), 'id' => "{$prefix}quote", 'type' => 'textarea', 'cols' => 20, 'rows' => 3, 'clone' => true, ), ) ); // All done now, output the meta return $meta_boxes; }
June 15, 2016 at 4:20 PM #3456Anh Tran
KeymasterThere is no reference to
course_cluster
as shown in the error log. Can you add these lines intowp-config.php
and check the error message again?define( 'WP_DEBUG', true ); define( 'CONCATENATE_SCRIPTS', false ); define( 'SCRIPT_DEBUG', true );
This code tells WP to not concatenate scripts and can show us the exact place of the error.
June 15, 2016 at 6:16 PM #3457MikeTrebilcock
ParticipantHi, Thanks for the reply.
added those lines to the config and updated metabox and now get this(in the console) when in the post edit screen:JQMIGRATE: Migrate is installed with logging active, version 1.4.0 jquery-migrate.js?ver=1.4.0:45 JQMIGRATE: jQuery.fn.live() is deprecated jquery-migrate.js?ver=1.4.0:47 console.trace()migrateWarn @ jquery-migrate.js?ver=1.4.0:47 jquery.js?ver=1.12.3:2 Uncaught Error: Syntax error, unrecognized expression: #course_cluster[]
Not sure if this helps, I thought the same thing regarding
course_cluster[]
I can't find it referenced anywhere.June 16, 2016 at 9:22 PM #3464Anh Tran
KeymasterI guess there is a JavaScript code that similar to this
$( '#course_cluster[]' )
which is an invalid selector in jQuery. As you're using Conditional Logic plugin, this expression might be displayed by the plugin, it can be auto-generated by term ID or something. Can you check the source HTML code to see whatcourse_cluster
is?June 20, 2016 at 9:01 PM #3502MikeTrebilcock
ParticipantFound the problem, or worked round it at least.
the problem was around JS validation, so once I had commented out this section, it worked:// VALIDATION ================= 'validation' => array( 'rules' => array( "{$prefix}ref_code" => array( 'required' => true, ), /*"{$prefix}cluster[]" => array( 'required' => true, ), "{$prefix}level_taxonomy[]" => array( 'required' => true, ), "{$prefix}campuses[]" => array( 'required' => true, ), "{$prefix}brands[]" => array( 'required' => true, ), */ ), // optional override of default jquery.validate messages 'messages' => array( "{$prefix}master_code" => array( 'required' => __( 'Course Master Code is required', 'master_code' ), ), /*"{$prefix}cluster[]" => array( 'required' => __( 'A Learning Area is required', 'cluster' ), ), "{$prefix}level_taxonomy[]" => array( 'required' => __( 'Course Level is required', 'level_taxonomy' ), ), "{$prefix}campuses[]" => array( 'required' => __( 'A Campus is required' ), ), "{$prefix}brands[]" => array( 'required' => __( 'A brand is required' ), ), */ ) ) );
not sure if this is an issue with my code or the loop though the validation rules is it was fine with the first rule, but I should be able to work round it adding the
'required' => true,
to the field itself.June 22, 2016 at 8:14 PM #3511Anh Tran
KeymasterOh, I see. The validation rules will use jQuery to find the elements with the selector = field's ID. As you're using the field with
'multiple' => true
, then it would adds[]
to the selector, which is invalid. Adding the'required' => true
to the field fixes this problem 🙂June 23, 2016 at 3:08 PM #3520MikeTrebilcock
ParticipantAll sorted, thanks so much for your help.
-
AuthorPosts
- The topic ‘Script errors when upgrading from metabox 4.5 > 4.8’ is closed to new replies.