Git Product home page Git Product logo

Comments (5)

wanjohiryan avatar wanjohiryan commented on May 27, 2024

Funny, if i use the form.response.message, instead of the scoped field.error to get display the error 'An account with this username already exists., it works... even when i change the value multiple times, and the username exists.

so here is my work around

throw new FormError<Form>('An account with this username already exists.',);
// remove this
// {
//     name: 'An account with this username already exists.'
// }

Then have the jsx look like this

<Field name="name">
     {(field, props) => (
        <>
            <label class='text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'>Username</label>
            <input {...props} placeholder="ryan" type="name" value={field.value} class='focus:ring-[0.1875rem] focus:ring-accent flex h-9 w-full rounded-md bg-[#E8F0FE] text-black px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-black/20 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50' />
            {field.error && (<p class='text-[0.8rem] font-medium text-red-500' >{field.error}</p>)}
            {form.response.message && (<p class='text-[0.8rem] font-medium text-red-500' >{form.response.message}</p>)}
            <p class='text-[0.8rem] text-muted-foreground'>This is your public display name. It can be your real name or a pseudonym.</p>
         </>
       )}
</Field>

from modular-forms.

wanjohiryan avatar wanjohiryan commented on May 27, 2024

Here is my two cents, i think it has to do with how you guys handle the field errors. It looks like disrupting the field state after:

  1. throwing an error on submission,
  2. throw another error if the form validation does not work
  3. then try to throw another error when on user submission will return a blank field error.

Thanks for your great work, Fabian. :)

from modular-forms.

fabian-hiller avatar fabian-hiller commented on May 27, 2024

Looks like a signal bug or problem in Qwik or do you thing it is related to our source code?

from modular-forms.

wanjohiryan avatar wanjohiryan commented on May 27, 2024

I am not using any Qwik useSignal code anywhere (from my snippet) so it most likely is stemming from somewhere in your source code.

How do you handle errors on submission per field?

from modular-forms.

fabian-hiller avatar fabian-hiller commented on May 27, 2024

In encountering myself some wired signal behavior in Qwik. I hope this gets better with v2. I am in exchange with the Qwik team. If you provide me with a minimal reproduction on StackBlitz I can try to investigate the problem. Here is a template: https://stackblitz.com/edit/modular-forms-qwik?file=src/routes/login/index.tsx

from modular-forms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.