File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 2424 $ : form = superF .form ;
2525 $ : enhance = superF .enhance ;
2626 $ : errors = superF .errors ;
27+ $ : reset = superF .reset ;
28+
29+ function resetForm() {
30+ console .log (' Reset!' );
31+ reset ({
32+ data: {
33+ points: 4
34+ }
35+ });
36+ }
2737 </script >
2838
2939<SuperDebug data ={$form } />
3040
3141<div >Resets: {resets }</div >
3242
43+ <div >Points: {$form .points }</div >
44+
3345<form method =" POST" use:enhance >
46+ <input type =" hidden" name =" points" value =" 0" /><br />
3447 <input type ="text" name ="name" bind:value ={$form .name } /><br />
3548 {#if $errors .name }<span >{$errors .name }</span ><br />{/if }
3649 <button >Submit</button >
50+ <button type ="button" on:click ={resetForm }>Client reset</button >
3751</form >
3852
3953<style lang =" scss" >
Original file line number Diff line number Diff line change 11import { z } from 'zod' ;
22
33export const schema = z . object ( {
4- name : z . string ( ) . min ( 2 )
4+ name : z . string ( ) . min ( 2 ) ,
5+ points : z . number ( ) . int ( )
56} ) ;
You can’t perform that action at this time.
0 commit comments