diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php
index 5995df64f21..dc4ef707a4e 100644
--- a/htdocs/core/tpl/admin_extrafields_add.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php
@@ -134,6 +134,12 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con
jQuery("#computed_value").keyup(function() {
init_typeoffields(jQuery('#type').val());
});
+
+ /* Autofill the code with label */
+ jQuery("#label").keyup(function() {
+ console.log("Update new field");
+ $("#attrname").val( $(this).val().replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() );
+ });
});
@@ -145,7 +151,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con
| trans("LabelOrTranslationKey"); ?> | |
| trans("LabelOrTranslationKey"); ?> | |
| trans("AttributeCode"); ?> | (trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>) |