$
(function () {
$newTFQ.find(
"input[id$=tbQuestion]" ).autocomplete({
source:
function (request, response) {
$.ajax({
url:
"Services/Questions.ashx" ,
dataType:
"jsonp" ,
async:
false ,
data: {
featureClass:
"P" ,
style:
"full" ,
type:
"tf" ,
maxRows: 10,
name_startsWith: request.term
},
success:
function (data) {
response($.map(data.questions,
function (q) {
return {
value:q.question,
answer:q.answer,
opta: q.opta,
optb: q.optb,
optc: q.optc,
optd: q.optd
}
}))
}
})
},
minLength: 4,
delay: 800,
focus:
function (event, ui) {
return false ;
},
select:
function (event, ui) {
$(
this ).val(htmlDecodeString20(ui.item.value));
if (ui.item.answer == "1" )
$newTFQ.find(
'.answertf' ).find( 'input[value="1"]' ).prop( "checked" , true );
else if (ui.item.answer == "0" )
$newTFQ.find(
'.answertf' ).find( 'input[value="0"]' ).prop( "checked" , true );
$newTFQ.find(
"input[name='" + tempstring1 + "'][value='1']" ).prop( "checked" , true );
$newTFQ.find(
"input[name='" + tempstring3 + "'][value='0']" ).prop( "checked" , true );
return false ;
}
});
});