Module: modules/forms

Form handling module for managing form submissions and validation.

Source:

Members

(static, constant) componentFields :Object

Component field definitions for each type. Defines the form fields required for each component type.

Type:
  • Object
Source:

Methods

(async, static) handleFormSubmit(event, initialConfigForm, errorMessageElement, successMessageElement, configSelect) → {Promise.<void>}

Handles initial configuration form submission.

Parameters:
Name Type Description
event Event

The form submit event

initialConfigForm HTMLFormElement

The configuration form element

errorMessageElement HTMLElement

The error message container

successMessageElement HTMLElement

The success message container

configSelect HTMLSelectElement

The configuration select dropdown

Source:
Returns:
Type
Promise.<void>

(static) prepareSimulationData(configId, signalType, componentsByFloor) → {Object}

Prepares simulation data payload for the backend.

Parameters:
Name Type Description
configId number

The configuration ID

signalType string

The signal type

componentsByFloor Object

Components organized by floor

Source:
Throws:

If required elements are not found

Type
Error
Returns:

The prepared simulation data object

Type
Object

(static) updateComponentForm(type)

Dynamically updates the component form fields based on selected type.

Parameters:
Name Type Description
type string

The component type (coaxial, derivador, distribuidor, toma)

Source:

(static) validateComponentForm(formData) → {boolean}

Validates that all required component fields are present and valid.

Parameters:
Name Type Description
formData FormData

The form data to validate

Source:
Returns:

True if all fields are valid, false otherwise

Type
boolean