this.field(name).value returns undefined in 2.3.3
See original GitHub issueJust 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
Issue Analytics
- State:
- Created 8 years ago
- Comments:17
Top Results From Across the Web
this.field(name).value returns undefined in 2.3.3 #340 - GitHub
Seems that this.field(name).value in custom validation always returns undefined. Here's my code new SimpleSchema( currentPassword: type: ...
Read more >Typescript: Object property returns "undefined" - Stack Overflow
I realised that userData is getting result from MySQL query using the "mysql2": "^2.3.3" package and the result is a RowDataPacket object.
Read more >7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
A detailed article about 'undefined' keyword in JavaScript. 7 tips on how to handle correctly 'undefined' and increase code durability.
Read more >undefined - JavaScript - MDN Web Docs - Mozilla
The global undefined property represents the primitive value undefined. It is one of JavaScript's primitive types.
Read more >HTML Standard
Full table of contents. 1 Introduction. 1.1 Where does this specification fit? 1.2 Is this HTML5? 1.3 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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. 😃
https://www.npmjs.com/package/simpl-schema