From 77c0e1f5d0c9b77233157772b9ef8b6f401945ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Sep 2022 14:18:24 +0200 Subject: [PATCH] Autofill code from label when adding new extrafield --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"); ?>)