Closed anupalhub closed 6 years ago
Here is my code implementation:
<a href="javascript:;" class="editableCustomSelectField" data-type="select2" data-pk="2270" data-multiple="true" data-source="http://localhost/Fields/getDropdown/3" data-value="" data-name="3" data-title="Colleges" ></a>
and here is the jQuery
$('.editableCustomSelectField').each(function(){ $(this).editable({ showbuttons: true, inputclass : 'form-control input-sm', url: baseUrl+'/Fields/editLead/'+lead_id, ajaxOptions: { dataType: 'json' }, send: 'always', validate: function(value) { if($(this).data('required') && $.trim(value) == '') { return 'This field is required'; } }, success: function(json, newValue) { if(json.success) $.bootstrapGrowl('<i class="fa fa-check"></i> Updated successfully'); else return json.error; }, select2: { cacheDataSource: true, multiple: $(this).data('multiple'), allowClear: true, placeholder: 'Choose...', id: function (item) { return item.id; }, }, tpl: '<select></select>', }); });
Json source is
[{"id":4,"text":"Uni one","value":4},{"id":5,"text":"Uni two","value":5},{"id":6,"text":"Uni three","value":6},{"id":7,"text":"Uni four","value":7}]
Everything working fine. but when i submit the after selecting it just return this without the values selected both in multiple true or false!
array( 'name' => '3', 'pk' => '2270' )
Please suggest any solution. Thanks in advance
Solved. I was using old version of select2.
Here is my code implementation:
and here is the jQuery
Json source is
Everything working fine. but when i submit the after selecting it just return this without the values selected both in multiple true or false!
Please suggest any solution. Thanks in advance