Collection settings
Control response reuse, reopening, collection windows, and capacity.
settings controls response reuse, reopening, collection dates, and submission
capacity for one survey.
Settings live beside the SurveyJS document. saveSurveySettings replaces the
whole object.
Fields
import type { SurveySettings } from "@dimah-survey/core";Prop
Type
saveSurvey inserts these defaults and then leaves the column alone.
saveSurveySettings replaces the whole object. Send every field. closesAt
must be later than opensAt when both are set. maxResponses is a positive
integer or null.
Reuse identified responses
For an identified respondent, startResponse applies responses atomically:
| Policy | Result |
|---|---|
"one-open" | Return the existing draft; otherwise create a new response |
"single" | Return the latest response of any status; create only when none exists |
Anonymous starts always create a new response and cannot list responses. See Authorization.
"single" can return a submitted or abandoned row. The fill Model opens in
display mode unless you reopen it. See React.
Enforce the window and cap
opensAt and closesAt are inclusive. Outside that window, start, partial
save, and submit throw SURVEY_CLOSED. Abandon, get, and reopen stay
available. GET /survey/published still returns the document, so the client
can show that the survey is closed.
maxResponses counts submitted rows. The check runs before a new insert and
before submit. At the cap, both fail with RESPONSE_LIMIT; returning an
existing response does not consume capacity.
Reopen a response
reopen: true lets reopenResponse move a submitted or abandoned row back to
draft. It clears submittedAt. The answers and the stored survey stay as
they are.
Reopening fails with OPEN_DRAFT if it would create a second draft for the
same identified respondent. When reopen is false, it fails with
RESPONSE_CLOSED.
Settings apply to later calls. They are not stored on the response, so a response already started keeps its survey.