console error "Uncaught SyntaxError: Invalid regular expression: /{0}/: Nothing to repeat"
 
    
        
                
            
                
                    Hi,
(fuelcms feature branch)
I have the following code in a model in the form fields function, it gets a list of products for the specific manufacturer and creates links to them in the products module:
        if(isset($values['make_id']) && !empty($values['make_id'])){
            $fields['Models'] = array('type' => 'fieldset', 'order' => 700, 'class' => 'tab');
            $this->db->select('model_id, model_name');
            $models = $this->db->get_where("model", array('model_make_id'=>$values['make_id']))->result();
            $order = 701;            
            if(isset($models) && !empty($models)){
                foreach($models as $model){
                    $fields[$model->model_name] = array('type' => 'button',
                                                    'displayonly' => true,
                                                    'label' => "
model_id}'>{$model->model_name}",
                                                    'order' => $order,
                                                );
                    $order++;
                }
            }
        }
when there is only one product it throws an error in the console:
"Uncaught SyntaxError: Invalid regular expression: /{0}/: Nothing to repeat"
which is in custom_fields.js:  
var regex = new RegExp('\{' + id + '\}', 'g');
while I suspect it's an issue with the way I'm putting the list together, I can't figure out what the issue it.
Regards
David                
 
                             
         
     
 
                 
             
        
Comments
var regex = new RegExp('\\{' + id + '\\}', 'g');
I've also noticed that my 1.4 branch is behind, doh
$inputs.each(function(i){ var id = ($(this).is('input[type="radio"], input[type="checkbox"]')) ? $(this).attr('name'): $(this).attr('id'); if (id){ var idArr = id.split('--'); id = idArr[idArr.length -1]; if (id){ replaceValues[id] = $(this).val(); var regex = new RegExp('\{' + id + '\}', 'g'); folder = folder.replace(regex, replaceValues[id]); } } })