Calculator form

etc.js loads the selected instrument's form, populates the filter menu, and handles calculation submissions.

etc.update_etcform(instrument)

Replace the current ETC form for an instrument and attach submission logic.

The form fragment is loaded asynchronously. After insertion, filter options are populated and form submission loads results into #modal-slot. A filter upload switches the results request from GET query parameters to POST form data. A valid saved filter selection takes precedence over the first configured default filter, then the first available filter. Stale saved IDs are replaced.

Arguments:
  • instrument (object) -- Instrument returned by the instruments API.

  • instrument.id (string) -- Instrument identifier used in UI URLs.

  • instrument.filters (object) -- Instrument filter configuration.

Returns:

Promise.<void> -- Resolves before the fragment request necessarily completes.

Example

await update_etcform({
  id: 'demo',
  filters: {transmissions: {g: {name: 'g', default: true}}}
});