Title: JS Error with another plug-in
Last modified: August 21, 2016

---

# JS Error with another plug-in

 *  [myxmlcigar](https://wordpress.org/support/users/myxmlcigar/)
 * (@myxmlcigar)
 * [12 years ago](https://wordpress.org/support/topic/js-error-with-another-plug-in/)
 * When adding new posts, I get the “red box” in the right corner of my WP admin
   panel.
 * The error reads as follows:
 * TypeError: rgb is undefined
    eventon_backend_post.js?ver=1 159
 * Line 159 reads: rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
 * the full function is:
 *  /** convert the HEX color code to RGB and get color decimal value**/
    function
   set_rgb_min_value(color,type){
 *  if( type === ‘hex’ ) {
    var rgba = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/
   i.exec(color); var rgb = new Array(); rgb[‘r’]= parseInt(rgba[1], 16); rgb[‘g’]
   = parseInt(rgba[2], 16); rgb[‘b’]= parseInt(rgba[3], 16); }else{ var rgb = color;}
 *  var val = parseInt((rgb[‘r’] + rgb[‘g’] + rgb[‘b’])/3);
 *  $(‘#evcal_event_color_n’).attr({‘value’:val});
    }
 *  function rgb2hex(rgb){
 *  if(rgb==’1′){
    return; }else{ rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)
   $/);
 *  return “#” +
    (“0” + parseInt(rgb[1],10).toString(16)).slice(-2) + (“0” + parseInt(
   rgb[2],10).toString(16)).slice(-2) + (“0” + parseInt(rgb[3],10).toString(16)).
   slice(-2); } }
 * This is a Themeforest WP calendar plug-in called EVENTON. When I disable AG Custom
   Admin, the error obviously goes away and vice versa – if I disable EVENTON plugin
   and enable AG Custom Admin, everything is fine.
 * I’ve contacted the plug-in author for EventON plug-in, and awaiting response,
   but thought I’d check here first.
 * AG Custom Admin is definitely one of the best admin plugins out there!!!
 * [https://wordpress.org/plugins/ag-custom-admin/](https://wordpress.org/plugins/ag-custom-admin/)

Viewing 1 replies (of 1 total)

 *  [WAP Support](https://wordpress.org/support/users/argonius/)
 * (@argonius)
 * [12 years ago](https://wordpress.org/support/topic/js-error-with-another-plug-in/#post-4884221)
 * Thanks! I would add check for undefined value in that file like this:
 * if(rgb == ‘1’){
    return; }else if(typeof rgb !== ‘undefined’){ //the same code
   from this block }
 * Hope that this will fix it!
 * BR,
    Argonius

Viewing 1 replies (of 1 total)

The topic ‘JS Error with another plug-in’ is closed to new replies.

 * ![](https://ps.w.org/ag-custom-admin/assets/icon.svg?rev=2928712)
 * [AGCA - Custom Dashboard & Login Page](https://wordpress.org/plugins/ag-custom-admin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ag-custom-admin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ag-custom-admin/)
 * [Active Topics](https://wordpress.org/support/plugin/ag-custom-admin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ag-custom-admin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ag-custom-admin/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [WAP Support](https://wordpress.org/support/users/argonius/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/js-error-with-another-plug-in/#post-4884221)
 * Status: not resolved