Different fixes in double select ajax calls

skala
Julio Montoya 13 years ago
parent f3a97be535
commit d7367f8ffe
  1. 7
      main/inc/lib/extra_field.lib.php
  2. 2
      main/inc/lib/extra_field_value.lib.php

@ -424,6 +424,7 @@ class ExtraField extends model {
$jquery_ready_content .= '
$("#'.$first_select_id.'").on("change", function() {
var id = $(this).val();
if (id) {
$.ajax({
url: "'.$url.'&a=get_second_select_options",
dataType: "json",
@ -438,6 +439,9 @@ class ExtraField extends model {
});
},
});
} else {
$("#second_extra_'.$field_details['field_variable'].'").empty();
}
});';
$first_id = null;
@ -449,7 +453,8 @@ class ExtraField extends model {
}
$options = ExtraField::extra_field_double_select_convert_array_to_ordered_array($field_details['options']);
$values = array();
$values = array('' => get_lang('Select'));
$second_values = array();
if (!empty($options)) {
foreach ($options as $option) {

@ -137,11 +137,13 @@ class ExtraFieldValue extends Model {
// only available for PHP 5.4 :( $result['field_value'] = $session_field_option->get($options[0])['id'].' -> ';
$result = $session_field_option->get($options[0]);
$result_second = $session_field_option->get($options[1]);
if (!empty($result)) {
$result['field_value'] = $result['option_display_text'].' -> ';
$result['field_value'] .= $result_second['option_display_text'];
}
}
}
}
return $result;
} else {
return false;

Loading…
Cancel
Save