mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
use addEventListener
This commit is contained in:
parent
4873233a05
commit
1139ec648d
@ -480,7 +480,7 @@ export function replaceAll(input: string, pattern: string | RegExp, replacement:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable empty FormElemnts before submitting the form.
|
* Disable empty FormElements before submitting the form. Purpose is to present a clean URL without empty variables.
|
||||||
*
|
*
|
||||||
* @param this HTMLFormElement where the FormElements need to be disabled.
|
* @param this HTMLFormElement where the FormElements need to be disabled.
|
||||||
*/
|
*/
|
||||||
@ -490,8 +490,10 @@ export function cleanGetUrl(this: HTMLFormElement): boolean {
|
|||||||
var form_elements = this.elements;
|
var form_elements = this.elements;
|
||||||
|
|
||||||
for (var element of form_elements) {
|
for (var element of form_elements) {
|
||||||
// The SELECT statement requires a different approach. It depends on the selectedIndex, rather that the value.
|
// All FormElements are presented as an 'Element'. In order to use the Form specific field, is has to be remapped to the correct FormElement
|
||||||
switch (element.nodeName) {
|
switch (element.nodeName.toUpperCase()) {
|
||||||
|
// The SELECT statement requires a different approach. It depends on the selectedIndex, rather that the value.
|
||||||
|
// selectIndex is only available in the HTMLSelectElement
|
||||||
case "SELECT":
|
case "SELECT":
|
||||||
const selectElement = element as HTMLSelectElement;
|
const selectElement = element as HTMLSelectElement;
|
||||||
if (
|
if (
|
||||||
@ -502,6 +504,7 @@ export function cleanGetUrl(this: HTMLFormElement): boolean {
|
|||||||
element.setAttribute('disabled','');
|
element.setAttribute('disabled','');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// All other FormElements are mapped to the HTMLInputElement to read out the 'value'
|
||||||
default:
|
default:
|
||||||
const inputElement = element as HTMLInputElement;
|
const inputElement = element as HTMLInputElement;
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user