Skip to content

Commit

Permalink
underscores not allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 committed Dec 11, 2024
1 parent 77a0292 commit 7cfbeeb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions templates/pages/admin/customobjects/main.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@
}
const reserved_names = {{ reserved_system_names|json_encode()|raw }}.map((n) => n.toLowerCase());
const existing_names = {{ existing_system_names|json_encode()|raw }}.map((n) => n.toLowerCase());
// label is made lowercase and spaces are replaced with underscores. All other characters are removed
$('#mainformtable input[name="system_name"]')
.val($('#mainformtable input[name="label"]').val().normalize('NFD').replace(/ /g, '_').replace(/[^a-z_]/gi, ''));
.val($('#mainformtable input[name="label"]').val().normalize('NFD').replace(/[^a-z]/gi, ''));
const system_name = $('#mainformtable input[name="system_name"]').val().toLowerCase();
if (reserved_names.includes(system_name) || system_name.endsWith('type') || system_name.endsWith('model')) {
$('#mainformtable input[name="system_name"]').get(0).setCustomValidity(__('The system name is a reserved name. Please enter a different label or manually change the system name.'));
Expand Down

0 comments on commit 7cfbeeb

Please sign in to comment.