문제

I've been successful in modifying the default classes and the negative class values to make sure that my ember-validations appear the way I want them to on load. Now, I'm diving into ember-validations. One of the validator routines I'm having little success with is the match: property. Here's the code from my controller:

    userLoginPass: {
        presence: { message: " password required" },
        match: { property: { "userRegPassConfirm" } }
    },
    userRegPassConfirm: {
        presence: { message: " confirm password required" },
        match: { property: { "userLoginPass" } }
    },

However, neither field barks on mis-match between them. Something is missing. Anyone had experience with this?

Here's the doc that's giving me problems: https://github.com/lcoq/ember-validations#match

Many Sincere Thanks!

도움이 되었습니까?

해결책

Turns out the answer is a two part process which includes making sure the confirmation field is labelled whateverConfirmation in addition to the confirmation property like so:

password: {
  confirmation: true,
     presence: {
       message: ' password required'
     }
   },

passwordConfirmation: {
  presence: {
    message: ' please confirm password'
    }
  }

as seen on the ember-validations documentation page:

https://github.com/dockyard/ember-validations#confirmation

다른 팁

You should define the validations object on your controller (or model) as follows:

validations: {
    userLoginPass: {
        confirmation: {
            message: 'Your message here.'
        }
    }
}

And then put an {{input userLoginConfirmation}} within your template.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top