applyValueToField function

Last updated: 2026-03-04T23:21:38.398Z

Metrics

LOC: 27 Complexity: 7 Params: 3

Signature

applyValueToField( field: FormField, value: string, ): : Promise<void>

Source Code

async function applyValueToField(
  field: FormField,
  value: string,
): Promise<void> {
  // Delegate to custom adapter if the field was detected by one
  if (field.adapterName) {
    const handled = await fillCustomComponent(field, value);
    if (handled) return;
  }

  const el = field.element;

  if (el instanceof HTMLSelectElement) {
    handleSelectElement(el, value);
    return;
  }

  if (
    el instanceof HTMLInputElement &&
    (el.type === "checkbox" || el.type === "radio")
  ) {
    handleCheckboxOrRadio(el);
    return;
  }

  setNativeValue(el, value);
}

Dependencies (Outgoing)

graph LR applyValueToField["applyValueToField"] fillCustomComponent["fillCustomComponent"] handleSelectElement["handleSelectElement"] handleCheckboxOrRadio["handleCheckboxOrRadio"] setNativeValue["setNativeValue"] applyValueToField -->|calls| fillCustomComponent applyValueToField -->|calls| handleSelectElement applyValueToField -->|calls| handleCheckboxOrRadio applyValueToField -->|calls| setNativeValue style applyValueToField fill:#dbeafe,stroke:#2563eb,stroke-width:2px click applyValueToField "59a962012828c5cb.html" click fillCustomComponent "fb27203fbaa0cd9b.html" click handleSelectElement "0a5f5d5c152645bc.html" click handleCheckboxOrRadio "cc82ce08938d0fd2.html" click setNativeValue "334bd99609d7c37c.html"

Impact (Incoming)

graph LR applyValueToField["applyValueToField"] doFillAllFields["doFillAllFields"] fillSingleField["fillSingleField"] fillContextualAI["fillContextualAI"] applyTemplate["applyTemplate"] doFillAllFields -->|calls| applyValueToField fillSingleField -->|calls| applyValueToField fillContextualAI -->|calls| applyValueToField applyTemplate -->|calls| applyValueToField style applyValueToField fill:#dbeafe,stroke:#2563eb,stroke-width:2px click applyValueToField "59a962012828c5cb.html" click doFillAllFields "23fe5c1a0125e335.html" click fillSingleField "e1740bceca6b34c2.html" click fillContextualAI "854e1a4562eb49e4.html" click applyTemplate "2ec007fc3b6a3513.html"
SourceType
doFillAllFields calls
fillSingleField calls
fillContextualAI calls
applyTemplate calls