Code Monkey home page Code Monkey logo

Comments (4)

fiddur avatar fiddur commented on May 17, 2024

Validation alone can be done by using tv4 (or JSV or such) alone.

I don't know about server-side validation, probably it could be done manually by a hook... @davidlgj?

from angular-schema-form.

davidlgj avatar davidlgj commented on May 17, 2024

Hi @aleclofabbro,

it depends on what you mean by server side validation errors. Do you want to do a regular post and then re render the form with validation messages and errors from the server? Or do you want to do an ajax request back to the server to validate a field? Can you describe your use case a bit more?

All validation is currently done with tv4js which has support for custom format validators, but they are synchronous so you can't do ajax requests within them.

Angular 1.3 has support for asynchrous validators via $asyncValidators so we might be able to support those via a form definition in the future.

from angular-schema-form.

torstenrudolf avatar torstenrudolf commented on May 17, 2024

@davidlgj Would it not be preferable to have an integrated sever side validation after the tv4 schema validation has passed?
What I am thinking of is, that you first do the client-side validation. If it passes, you do your ajax call. But then you can have two outcomes. Firstly, the server accepts the call and everything is good. Or the server rejects and gives some sort of an error back. If this error would be an error dictionary with the form fields as keys, it would be nice to be able to display them.

E.g. a registration form. The server will check if the chosen username already exists. If so, registration is not allowed with this name.

from angular-schema-form.

littlemaneuver avatar littlemaneuver commented on May 17, 2024

+1. We're trying to use HATEOAS rest api and problem+json for resonding on invalid form. So, how to make it possible to validate fields again regarding new problem-json schema, not initial one. I know that the best way i sto make client's rules closest to the server's, but still some conditions can be processed only on the server (e.g. username is already in use)

from angular-schema-form.

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.