I started using FormKit and I would like to find the way to get the form schema from a form defined in the code.
<script setup>
import '@formkit/themes/genesis'
const createUser = async (fields) => {
await new Promise((r) => setTimeout(r, 1000))
alert(JSON.stringify(fields))
console.log(fields)
}
</script>
<template>
<div><h2>My first form</h2></div>
<div class="container">
<div class="row">
<FormKit type="form" @submit="createUser" submit-label="Salva utente">
<div class="col-12">
<FormKit type="text" name="nome" id="nome" label="Nome" help="Inserisci il tuo nome di battesimo" placeholder="Mario" />
</div>
<div class="col-12">
<FormKit type="text" name="cognome" id="cognome" label="Cognome" help="Inserisci il tuo cognome" placeholder="Rossi" />
</div>
<div class="col-12">
<FormKit
type="select"
label="What planet is the largest?"
placeholder="Select a planet"
name="planet"
:options="{
mercury: 'Mercury',
venus: 'Venus',
earth: 'Earth',
mars: 'Mars',
jupiter: 'Jupiter',
saturn: 'Saturn',
uranus: 'Uranus',
neptune: 'Neptune',
}"
validation="required|is:jupiter"
validation-visibility="dirty"
:validation-messages="{
is: 'Nope! Jupiter is the largest planet',
}"
/>
</div>
</FormKit>
</div>
</div>
</template>
As I have some issue building the schema from scratch, I would like to use some test form to get the schema and look how it is defined. Then I will use it to understand better, do some tests and finally store the real final schema to db to generate form by form schema.
So my final question is: is there a way I can use to get the form schema?
Kind regards, Matteo