Submitting a form with a schedule
In this example, we demonstrate how to render a form with a timeInterval field using native datetime-local inputs and submit a time slot to the OneEntry API.
β
Purpose of the scenario:
- Get form configuration with a timeInterval field from OneEntry Platform.
- Render start/end pickers with the native datetime-local input.
- Submit a selected time slot to the OneEntry API.
β
What you need:
- A valid PROJECT_URL and APP_TOKEN for authentication with the OneEntry API.
- A pre-configured form in OneEntry identified by the marker 'schedule'.
- A pre-configured timeInterval attribute in the schedule form.
π Important:
- The timeInterval value must be wrapped in an extra array: [[startISO, endISO]], not [startISO, endISO].
- start must be strictly earlier than end β otherwise the API rejects the value with the "date.invalidOrder" validation code.
- Time values must be in ISO 8601 format (UTC) β convert the local picker value with new Date(value).toISOString().
- Use form.identifier from the API response as formIdentifier β passing the marker can produce "Incorrect formIdentifier for provided config" when they differ.
- Handle potential errors during API requests gracefully to provide feedback to users.
π See in documentation:
π¦ SDK reference:
Loading sandboxβ¦
