diff --git a/src/lib/components/forms/AddOnDispatch.svelte b/src/lib/components/forms/AddOnDispatch.svelte index 8390898ed..57d65c28f 100644 --- a/src/lib/components/forms/AddOnDispatch.svelte +++ b/src/lib/components/forms/AddOnDispatch.svelte @@ -14,6 +14,7 @@ } from "$lib/api/types"; import { enhance } from "$app/forms"; + import { page } from "$app/stores"; import { afterNavigate } from "$app/navigation"; import Ajv from "ajv"; @@ -60,6 +61,12 @@ event: schedules[event.event], }; } + // prefill values from search params + new URLSearchParams($page.url.searchParams).forEach((v, k) => { + if (k in properties) { + $values[k] = v; + } + }); }); function objectify(params: any) { diff --git a/src/lib/components/forms/stories/AddOnDispatch.stories.svelte b/src/lib/components/forms/stories/AddOnDispatch.stories.svelte index 769dbcd6b..561dfefc5 100644 --- a/src/lib/components/forms/stories/AddOnDispatch.stories.svelte +++ b/src/lib/components/forms/stories/AddOnDispatch.stories.svelte @@ -5,6 +5,7 @@ import Flex from "$lib/components/common/Flex.svelte"; import { addonsList } from "@/test/fixtures/addons"; + import { APP_URL } from "@/config/config"; const addons = addonsList.results; @@ -26,7 +27,7 @@ required={addon.parameters.required} eventOptions={addon.parameters.eventOptions} /> -
$values
{JSON.stringify($values, null, 2)}