In alert command preview is not array but contain data, create textarea instead of select

This commit is contained in:
m-lopez-f 2015-03-26 15:33:37 +01:00
parent cfb676eb70
commit c7b3104224
2 changed files with 34 additions and 21 deletions

View File

@ -120,24 +120,32 @@ if (is_ajax ()) {
$fields_value_select = array();
$fv = explode(';', $field_value);
if (!empty($fv)) {
foreach ($fv as $fv_option) {
$fv_option = explode(',', $fv_option);
if (empty($fv_option))
continue;
if (!isset($fv_option[1]))
$fv_option[1] = $fv_option[0];
$fields_value_select[$fv_option[0]] = $fv_option[1];
if (count($fv) > 1) {
if (!empty($fv)) {
foreach ($fv as $fv_option) {
$fv_option = explode(',', $fv_option);
if (empty($fv_option))
continue;
if (!isset($fv_option[1]))
$fv_option[1] = $fv_option[0];
$fields_value_select[$fv_option[0]] = $fv_option[1];
}
}
}
$ffield = html_print_select($fields_value_select,
'field'.$i.'_value', '', '', '', 0, true, false, false, 'fields');
$rfield = html_print_select($fields_value_select,
'field'.$i.'_recovery_value', '', '', '', 0, true, false, false, 'fields_recovery');
$ffield = html_print_select($fields_value_select,
'field'.$i.'_value', '', '', '', 0, true, false, false, 'fields');
$rfield = html_print_select($fields_value_select,
'field'.$i.'_recovery_value', '', '', '', 0, true, false, false, 'fields_recovery');
}
else{
$ffield = html_print_textarea ('field' . $i . '_value',1, 1, $fv[0],
'style="min-height:40px" class="fields"', true);
$rfield = html_print_textarea ('field' . $i . '_recovery_value', 1, 1, $fv[0],
'style="min-height:40px" class="fields_recovery"', true);
}
}
}
else {

View File

@ -284,7 +284,8 @@ $(document).ready (function () {
$table_macros_field.hide();
continue;
}
old_value = '';
old_recovery_value = '';
// Only keep the value if is provided from hidden (first time)
if (($("[name=field" + i + "_value]").attr('id'))
== ("hidden-field" + i + "_value")) {
@ -301,10 +302,14 @@ $(document).ready (function () {
// Replace the old column with the new
$table_macros_field.replaceWith(field_row);
$("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
if (old_value != '' && old_recovery_value != ''){
$("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
}
else{
$("[name=field" + i + "_value]").val($("[name=field" + i + "_value]").val());
$("[name=field" + i + "_recovery_value]").val($("[name=field" + i + "_recovery_value]").val());
}
// Add help hint only in first field
if (i == 1) {
var td_content = $table_macros_field.find('td').eq(0);