aurelia / validatejs

Enables expressive validation using decorators and/or a fluent API.
MIT License
22 stars 23 forks source link

Create a ValidationRenderer documentation is unclear / doesn't work #106

Closed CarlosOnline closed 8 years ago

CarlosOnline commented 8 years ago

Documentation for aurelia validation's Create a ValidationRenderer step is unclear / missing stuff. From: http://blog.durandal.io/2016/06/14/new-validation-alpha-is-here/

9) Create a ValidationRenderer

First: Does aurelia-validation include a default renderer? If so, how do I use it? If not can you add one?

Second: Adding validation-renderer="bootstrap-form" attribute returns error. aurelia-task-queue.js:47 Uncaught TypeError: renderers[i].render is not a function

I downloaded ValidationRenderer from https://gist.github.com/jdanyow/ea843c24956cfffff48bb21776291f6a and added it to my typescript asp.net project - modified for compilation.

Third: To get it to work, had to call addRenderer with the instantiated BootstrapFormValidationRenderer. this.validationController.addRenderer(<ValidationRenderer><any>(validationRenderer));

Forth: Can the documentation be added to the aurelia hub? There are multiple sources of documentation on the net, and some them are no longer correct.

EisenbergEffect commented 8 years ago

The validation library is very alpha and still undergoing significant changes. Thanks for the feedback. We'll definitely add and clarify docs in the future, especially as various aspects of the design stabilize.

CarlosOnline commented 8 years ago

Can I use the old validation library with latest Aurelia releases?

Is so what jspm install should I use?

EisenbergEffect commented 8 years ago

Yes, you can use it. You need to install from this branch: https://github.com/aurelia/validation/tree/sunset-0.6.0 Just bear in mind that isn't supported, so we can't fix issues or answer any questions related to that code.

EisenbergEffect commented 8 years ago

@jdanyow If there's a quick fix you can do in the readme, that might go a long way.

CarlosOnline commented 8 years ago

The typescript definition file has an error. I had to comment out the line to compile.

Error: typings\modules\aurelia-validatejs\index.d.ts(11,22): error TS2307: Cannot find module 'validate.js'.

Offending line: import validate from 'validate.js';

jadrake75 commented 8 years ago

This kind of hung me up as well (not having the renderer as part of validationjs). Also the documentation did not mention you need to add it as a plugin in the main.js

to be clear... aurelia.use.feature('bootstrap-validation') in main.js

This renderer is pretty decent for bootstrap implementations. Would this be added to the library? Or perhaps there should be a small aurelia library for bootstrap "plugins" and other tidbits? I am willing to be that 75% of Aurelia development projects are using bootstrap (not saying all - just a large number)

jdanyow commented 8 years ago

full docs will be added when the API settles

ritikajain7 commented 7 years ago

Hi, I am getting the same error - "ERROR [app-router] TypeError: renderer.render is not a function at ValidationController.addRenderer (http://localhost:9000/jspm_packages/npm/aurelia-validation@0.12.5/validation-controller.js:74:22)". Can you please guide what should I do?