add js on change action

This commit is contained in:
John BOTELLA 2022-04-29 17:04:43 +02:00
parent 56bab82219
commit fb35e710b3

View File

@ -231,24 +231,19 @@ if ($massaction == 'edit_extrafields') {
$outputShowOutputFields = '<div class="extrafields-inputs">'; $outputShowOutputFields = '<div class="extrafields-inputs">';
//
// foreach ($extrafields_list as $extraKey => $extraLabel){ foreach ($extrafields_list as $extraKey => $extraLabel) {
// $outputShowOutputFields.= '<div class="mass-action-extrafield_'.$key.'">'; $outputShowOutputFields.= '<div class="mass-action-extrafield" data-extrafield="'.$extraKey.'" style="display:none;" >';
// $outputShowOutputFields.= $extrafields->showInputField($extraKey, '', '', $keysuffix, '', 0, $objecttmp->id, $objecttmp->table_element);
// $outputShowOutputFields.= 'rrrrrrrr'.$extrafields->showInputField($key, '', '', $keysuffix, '', 0, $objecttmp->id, $objecttmp->table_element).'dddddddddd'; $outputShowOutputFields.= '</div>';
// $outputShowOutputFields.= 'rrrrrrrr'.$extrafields->showInputField($key, '', '', $keysuffix, '', '', $objecttmp->id, $objecttmp->table_element).'dddddddddd'; }
//
// $outputShowOutputFields.= '</div>';
// }
$outputShowOutputFields.= '<table>'.$object->showOptionals($extrafields, 'create').'</table>';
$outputShowOutputFields.= '<script> $outputShowOutputFields.= '<script>
jQuery(function($) { jQuery(function($) {
$(".extrafields-inputs .valuefieldcreate").hide();
$("#extrafield-key-to-update").on(\'change\',function(){ $("#extrafield-key-to-update").on(\'change\',function(){
let selectedExtrtafield = $(this).val(); let selectedExtrtafield = $(this).val();
if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){ if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
$(".extrafields-inputs .valuefieldcreate").hide(); $(".mass-action-extrafield").hide();
$(".extrafields-inputs .product_extras_"+selectedExtrtafield).show(); $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
} }
}); });
}); });