Giter VIP home page Giter VIP logo

Comments (6)

dextermb avatar dextermb commented on August 31, 2024 1

@chainlist I've just ran into this issue, looking through the v2 documentation I don't see anything about manually setting errors.

I've also noticed some of the sidebar links don't go to the right sections

from svelte-forms.

nyanpasu avatar nyanpasu commented on August 31, 2024

Neat, realized that the set and update functions of the store are also exported. Maybe a helper / util method would be nice to have, so that users can add errors without needing to handle the shape of the store.

But otherwise I can still handle this issue on my end. Cheers.

from svelte-forms.

chainlist avatar chainlist commented on August 31, 2024

Hi,

A v2 of svelte-forms has been released that fixes this use case.
Check out the new documentation website

from svelte-forms.

aniolekx avatar aniolekx commented on August 31, 2024

This issue was closed, but it is still not clear how to add errors from server (or API). When I submit form, server side validation can return additinal errors related to particular field, how can I add these errors to field to render it? I have tested today several solutions but nothing was working. These errors from server were not rendered in form. This seems to be common requirement.

from svelte-forms.

aniolekx avatar aniolekx commented on August 31, 2024

Hi,

A v2 of svelte-forms has been released that fixes this use case. Check out the new documentation website

can find anything related :/

from svelte-forms.

aniolekx avatar aniolekx commented on August 31, 2024

async function set(field, forceValidation = false) { if (!isField(field)) { field = processField(get(store), [], { value: field }); } if (forceValidation || options.validateOnChange) { let validations = await getErrors(field, validators, options.stopAtFirstError); _set(processField(field, validations, { dirty: true })); } else { _set(processField(field, null, { dirty: true })); } }

ok, maybe I have found the problem, even when forceValidation is set to false, options.validateOnChange is triggering validation and overwrites my custom errors, unfortunately I cannot disable it because this will affect user experience, but I need a method to set it without triggering any validation, otherwise it will overwrite my custom errors, any suggestions?

from svelte-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.