选择建议并提交表单后,我看到输入字段的值是错误的。我从php文件中收到了“desc”的值。我想从php文件中获取“DS”的值,有什么不对(我认为在js-code中)?
$query = $objTable->find('all')
->where(['admin_template_id' => $id])
->contain(['AdminObjects']);
给定的php数组
$('#orga_name').typeahead(null,
{
name: 'orga_name_autosuggest',
displayKey: 'desc',
input: 'value',
highlight: true,
hint: false,
limit: 5,
minLength: 2,
wildcard: '%QUERY',
source: datas.ttAdapter(),
templates: {
suggestion: Handlebars.compile([
'<div class=\"media\">',
'<div class=\"pull-left\">',
'<div class=\"media-object\">',
'<img src=\"{{img}}\" width=\"50\" height=\"50\"/>',
'</div>',
'</div>',
'<div class=\"media-body\">',
'<h4 class=\"media-heading\">{{value}}</h4>',
'<p>{{desc}}</p>',
'</div>',
'</div>',
].join(''))
}
});