Hello everyone,
like my title say, when I select one term in the multiple select box, all terms who have the same option value/id are displayed/sent in the input.
Is this a normal comportment ? Is there a solution ? Here my code :
function formatRepo (repo) {
		console.log('formatRepo');
		return repo.text;
	}
	function formatRepoSelection (repo) {
		console.log('formatRepoSelection');
		return repo.text;
	}
	$('.chosen-select').select2({
		ajax: {
			url: ajaxobject.ajaxurl,
			dataType: 'json',
			data: function (params) {
				var tax_name = $("[name=main_cat_choice]").val();
				return {
					search: params.term, // search query
					action: 'keyword_terms_mobile',
					tax_name: tax_name,
					type: 'public'
				};
			},
			processResults: function( data ) {
				console.log("processResults: "+data);
				var options = [];
				if ( data ) {
					// data is the array of arrays, and each of them contains ID and the Label of the option
					$.each( data, function( index, text ) { // do not forget that "index" is just auto incremented value
						options.push( { id: text.id, text: text.label  } );
					});
				}
				return {
					results: options
				};
			},
			// Additional AJAX parameters go here; see the end of this chapter for the full code of this example
		},
		templateResult: formatRepo,
		templateSelection: formatRepoSelection,
		// theme: "classic"
	});
Thank you !
