meteor-simple-schema: this.field(name).value returns undefined in 2.3.3
Just upgraded to 2.3.3 and noticed that custom validation is suddenly not working anymore. Seems that this.field(name).value in custom validation always returns undefined. Here’s my code
new SimpleSchema(
currentPassword:
type: String
min: 4
instructions: 'Current password'
label: 'Current password'
newPassword:
type: String
min: 4
label: 'New password'
confirmPassword:
type: String
min: 4
label: 'Confirm new password'
custom: ->
if @value != @field('newPassword').value
return "passwordMismatch"
@field(‘newPassword’).value returns undefined. Before latest verion this was working just fine
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17
Here’s a sample app, which is a slice of a larger app I’m currently working on, where we’re having this issue. https://github.com/jakobloekke/simple-schema-issue-340-repro/tree/master https://www.youtube.com/watch?v=l7GXF5eMGOk (There’s a little bit of erratic clicking in the video, but I hope the point comes across).
In short, we have an account url (‘slug’) which is auto generated from an AccountName field. This works on inserts but not on updates, causing the value to become empty.
From the documentation I am unsure if this is expected behaviour. But it feels like a bug to us. 😃