Skip to content

Commit

Permalink
Merge pull request #28827 from jyhere/patch-10
Browse files Browse the repository at this point in the history
UPDATE: add a conf param to disable extrafields code autofill
  • Loading branch information
eldy authored Mar 15, 2024
2 parents 3ba2ae1 + 0872f82 commit 60e159f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion htdocs/core/tpl/admin_extrafields_add.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ function init_typeoffields(type)
});

/* Autofill the code with label */
<?php if (!getDolGlobalInt('MAIN_EXTRAFIELDS_CODE_AUTOFILL_DISABLED')) : ?>
jQuery("#label").keyup(function() {
console.log("Update new field");
$("#attrname").val( $(this).val().replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() );
$("#attrname").val( $(this).val().normalize('NFD').replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() );
});
<?php endif; ?>
});
</script>

Expand Down

0 comments on commit 60e159f

Please sign in to comment.