question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

this.field(name).value returns undefined in 2.3.3

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
jakobloekkecommented, May 17, 2016

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. 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found