Fix generated FQDN not being submitted
All checks were successful
Tests / test (push) Successful in 29s
All checks were successful
Tests / test (push) Successful in 29s
Closes #241
This commit is contained in:
parent
6c2795d4fa
commit
2f593360fe
2 changed files with 11 additions and 1 deletions
|
|
@ -129,6 +129,8 @@ const updateRemoveButtonVisibility = (container) => {
|
|||
})
|
||||
}
|
||||
|
||||
window.updateHiddenInput = updateHiddenInput
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initDynamicArrayWidget)
|
||||
document.addEventListener('htmx:afterSwap', initDynamicArrayWidget)
|
||||
document.addEventListener('htmx:afterSettle', initDynamicArrayWidget)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
const initializeFqdnGeneration = () => {
|
||||
const nameField = document.querySelector('input[name="name"]');
|
||||
const nameField = document.querySelector('input#id_name');
|
||||
const fqdnField = document.querySelector('label[for="id_spec.parameters.service.fqdn"] + div input.array-item-input');
|
||||
|
||||
if (nameField && fqdnField) {
|
||||
|
|
@ -17,6 +17,10 @@ const initializeFqdnGeneration = () => {
|
|||
newNameField.addEventListener('input', function() {
|
||||
if (!newFqdnField.dataset.manuallyEdited) {
|
||||
newFqdnField.value = generateFqdn(this.value);
|
||||
const container = newFqdnField.closest('.dynamic-array-widget');
|
||||
if (container && window.updateHiddenInput) {
|
||||
window.updateHiddenInput(container);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -26,6 +30,10 @@ const initializeFqdnGeneration = () => {
|
|||
|
||||
if (newNameField.value && !newFqdnField.value) {
|
||||
newFqdnField.value = generateFqdn(newNameField.value);
|
||||
const container = newFqdnField.closest('.dynamic-array-widget');
|
||||
if (container && window.updateHiddenInput) {
|
||||
window.updateHiddenInput(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue