diff --git a/js/table/relation.js b/js/table/relation.js index ac4cb48c00..cdfdf64ee5 100644 --- a/js/table/relation.js +++ b/js/table/relation.js @@ -190,8 +190,12 @@ AJAX.registerOnload('table/relation.js', function () { $newRow.find('a.add_foreign_key_field').attr('data-index', newIndex); // Update form parameter names. - $newRow.find('select[name^="foreign_key_fields_name"]').not().first().find( - 'select[name^="destination_foreign_column"]').not().first() + $newRow.find('select[name^="foreign_key_fields_name"]') + .not($newRow.find('select[name^="foreign_key_fields_name"]').first()) + .find('select[name^="destination_foreign_column"]') + .not($newRow.find('select[name^="foreign_key_fields_name"]') + .not($newRow.find('select[name^="foreign_key_fields_name"]').first()) + .find('select[name^="destination_foreign_column"]').first()) .each(function () { $(this).parent().remove(); });