Skip to content

createPublicLookupSource

createPublicLookupSource(url, doFetch?): LookupSource

A LookupSource that searches through a form’s public lookup endpoint: a POST of the field’s key and what was typed, answered with { options: [{ value, label }] }. A POST for the reason the submission is one: a respondent’s text does not belong in a URL, a log line or a Referer header.

Needs no API key and runs in a browser. It rejects when the request is refused or fails, which is how a Lookup field learns to fall back to a plain text input; it never returns a partial answer.

string

The lookup endpoint. For a form fetched with this package it is submissionUrl with /submissions replaced by /lookup; see lookupUrlFromSubmissionUrl.

(input, init?) => Promise<Response>

LookupSource