added POST-endpoint for userform

Co-authored-by: haraldnilsen <harald_998@hotmail.com>
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
Sindre Kjelsrud 2023-12-21 19:31:14 +01:00
parent b78003b4fc
commit dd8f22b043
Signed by: sidski
GPG key ID: D2BBDF3EDE6BA9A6
7 changed files with 74 additions and 18 deletions

View file

@ -1,7 +1,14 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
function handleFormChange(selectedValue: string) {
dispatch('update', selectedValue);
}
export let inputType:string
export let label:string
export let options: string[]
export let formData: string
import RadioButtons from "./inputs/RadioButtons.svelte"
import Select from "./inputs/Select.svelte";
</script>
@ -9,9 +16,9 @@
<div class="flex justify-start items-center h-1/4 w-full ">
<p class="text-primary font-bold w-1/5">{label}:</p>
{#if inputType == "radio"}
<RadioButtons options={options}/>
<RadioButtons on:update={(e) => handleFormChange(e.detail)} selected={formData} options={options}/>
{/if}
{#if inputType == "select"}
<Select options={options}/>
<Select on:update={(e) => handleFormChange(e.detail)} options={options}/>
{/if}
</div>