i've put the code inside the file: editQuestion_view.php (in limesurvey\application\views\admin\survey\Question)
here is the script:
$("#parolaauto")
.on( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).autocomplete( "instance" ).menu.active ) {
event.preventDefault();
}
})
.autocomplete({
source: function( request, response) {
$.ajax({
url: "searchanagramletter.php",
dataType: "json",
data: {
term: request.term,
nsillabe: $('#nsillabe option:selected').val(),
nchar: $('#nchar option:selected').val(),
n_anagrammi: $('#n_anagrammi option:selected').val()
},
success: function( data ) {
response( data );
}
});
},
minLength: 0,
autoFocus:true,
response: function (event, ui) {
var len = ui.content.length;
if (len<1)
{
$('#parolaauto').val('');
$('#num_parole').val('0');
}
else
{
$('#num_parole').val(len);
}
},
select: function( event, ui ) {
//alert(JSON.stringify(ui.item))
log( ui.item.label, ui.item.letter, ui.item.nsillabe, ui.item.nchar, ui.item.n_anagrammi, ui.item.anagrammi);
}
});
i've tried the script in a stand alone application and i don't have any problem, in limesurvey, there's something regarding token control: YII_CSRF_TOKEN
but i'm not sure, maybe there's a control to check the integrity of file, or if the file is a "limesurey file", i've noticed that when i call the script (for autcomplete, and before for load the page in a dialog) some code is append to my request:
GET searchanagramletter.php?YII_CSRF_TOKEN=84ee15c94793409919f931a13e06f0c004d9ec20&term=abar&nsillabe=
The topic has been locked.