Do the autocomplete field correct

This commit is contained in:
Arturo Gonzalez 2017-08-30 15:52:28 +02:00
parent 0594a7bcbc
commit 0eabf7a0ce
3 changed files with 5 additions and 64 deletions

View File

@ -261,6 +261,9 @@ $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$table->data[3][1] = ui_print_agent_autocomplete_input($params);
$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
@ -579,37 +582,6 @@ ui_require_jquery_file('bgiframe');
}
});
$("#text-id_parent").on("autocompletechange", function () {
agent_id=$("#hidden-id_parent").val();
var params = {};
params["get_agent_modules_json_by_name"] = 1;
params["id_agent"] = agent_id;
params["page"] = "include/ajax/module";
jQuery.ajax ({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
success: function (data) {
$('#cascade_protection_module').empty();
$('#cascade_protection_module')
.append ($('<option></option>')
.html("Any")
.prop("value", 0)
.prop("selected", 'selected'));
jQuery.each (data, function (i, val) {
$('#cascade_protection_module')
.append ($('<option></option>')
.html(val['name'])
.prop("value", val['id_module'])
.prop("selected", 'selected'));
});
}
});
});
paint_qrcode(
"<?php
echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente);

View File

@ -337,6 +337,8 @@ $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[0][1] .= "<b>" . __('Cascade protection'). "</b>&nbsp;" .
@ -566,38 +568,6 @@ $(document).ready (function () {
}
});
$("#text-id_parent").on("autocompletechange", function () {
agent_id = $("#hidden-id_parent").val();
var params = {};
params["get_agent_modules_json_by_name"] = 1;
params["id_agent"] = agent_id;
params["page"] = "include/ajax/module";
jQuery.ajax ({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
success: function (data) {
$('#cascade_protection_module').empty();
$('#cascade_protection_module')
.append ($('<option></option>')
.html("Any")
.prop("value", 0)
.prop("selected", 'selected'));
jQuery.each (data, function (i, val) {
$('#cascade_protection_module')
.append ($('<option></option>')
.html(val['name'])
.prop("value", val['id_module'])
.prop("selected", 'selected'));
});
}
});
});
$("#form_agent").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;

View File

@ -3118,7 +3118,6 @@ function ui_print_agent_autocomplete_input($parameters) {
.attr("value", val["id_agente_modulo"]).text (s));
});
$("#' . $selectbox_id . '").enable();
$("#' . $selectbox_id . '").fadeIn ("normal");
}
});