Closed Routhinator closed 11 years ago
Exact error when 'passwordConfirm' is present in template:
Uncaught TypeError: Cannot call method 'render' of undefined
Have you added passwordConfirm to your schema alongside password?
On 5 Jul 2013, at 17:24, Chris Routh notifications@github.com wrote:
I'm trying to get a match validator working in my sign-up form. I've added the example:
password: { validators: [ { type: 'match', field: 'passwordConfirm', message: 'Passwords must match!' } ]}
and in my template:
Must be at least 7 characters:However adding the 'passwordConfirm' field breaks render as Backbone.Form seems to have no idea what to do with passwordConfirm - If I remove 'passwordConfirm' the form renders however match validation cannot possibly work as there is no confirmation field.
— Reply to this email directly or view it on GitHub.
I wondered about that but it wasn't in the example and it seemed nonsensical to add something to the schema that doesn't exist in the JSON model, I was expecting errors if I did that.
Just tried that and it's resolved it.
Yes it does seem out of place on the model schema but you can specify the schema on the form itself (or extend the models schema before adding it to the form) if you want to keep it more semantic.
On 5 Jul 2013, at 18:01, Chris Routh notifications@github.com wrote:
I wondered about that but it wasn't in the example and it seemed nonsensical to add something to the schema that doesn't exist in the JSON model, I was expecting errors if I did that.
Just tried that and it's resolved it.
— Reply to this email directly or view it on GitHub.
I'm trying to get a match validator working in my sign-up form. I've added the example:
password: { validators: [ { type: 'match', field: 'passwordConfirm', message: 'Passwords must match!' } ]}
and in my template:
However adding the 'passwordConfirm' field breaks render as Backbone.Form seems to have no idea what to do with passwordConfirm - If I remove 'passwordConfirm' the form renders however match validation cannot possibly work as there is no confirmation field.