aurelia / validatejs

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

Issue with the binding behavior "& validate" #89

Closed y2k4life closed 8 years ago

y2k4life commented 8 years ago

I know my last issue was closed (https://github.com/aurelia/validatejs/issues/88). I did everything I could with getting to -beta.2.x.x (minus webpack-plugin) and fixing the .d.ts files.

All is working up to the point of adding & validate I get this No BindingBehavior named "validate" was found!

So I try to fix it by adding aurelia-validation as a plugin with this:

    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .plugin('aurelia-dialog')
        .plugin('aurelia-validatejs')

Then I get this error: Error: Cannot find module './aurelia-validation/validation-errors-custom-attribute'.

Is there an error or am I doing something wrong?

EisenbergEffect commented 8 years ago

I think that's a bug with the validation plugin's build configuration. Part of last week and all this week we are in a transitional state with respect to both TypeScript and Webpack. This is all in preparation for the RC. Basically, we had to break things in order to fix them. The Webpack plugin and skeleton got updated on a different timeline than the validation plugin. So, these two need to be synced. I've asked our Webpack developer to sync the validation library with his latest Webpack build work already.

Thanks for your patience in all of this. We're sorry for the issues. It should all be fixed (and much improved) soon.

y2k4life commented 8 years ago

Thank you for the updates, I will try and waiting, but I don't know if I can. :)

I'm persistent, because this is like a plugin I'm using aurelia-dialog of what needs to be done.

I now have this in webpack.config.js in the plugins section.

    new AureliaWebpackPlugin({
      includeSubModules: [
        { moduleId: 'aurelia-dialog' },
        { moduleId: 'aurelia-validation' }
      ]
    })

One step closers.

y2k4life commented 8 years ago

Got it!!!

I know this is alpha too, but...

The blog was or is missing a key component and leaves is it up to assumptions. Once you get to the 9) Create a ValidationRenderer it drops off with details. Looking at source code I figured this is done via DI and the validation plugin looks in the container for the key and the key is what is the value of the custom element validation-renderer' and in this case it is bootstrap-form. Also it is assumed that one has to create BootstrapFormValidationRenderer. I copied from the link, put it in my project, (fixed it up for TS, element.error?) Connecting these dots will help. All this to say I was able to get it to work. I know this is alpha and you are more or less telling us what is coming. I just want to help you help me help the community and the little things like this can make it happen even better.

Maybe add something like this, which is needed as well to make it work. The adding the plugins is missing as well in the blog post.

    aurelia.container.registerTransient("bootstrap-form",BootstrapFormValidationRenderer);

    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .plugin('aurelia-validatejs')
        .plugin('aurelia-validation')

Keep up the good work and can't wait for RC and RTM! Now I have to add (some) validation to the app, clients will be looking for it on Monday. :)