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.

Custom attribute running once only

See original GitHub issue

my select radio only runs the Custom attribute once, while the others run every time I submit.

The first on is the radio, the second one is just a input. The latter, custom, runs every time I hit submit and displays an validation error fine. The former, radio, runs only once, the first time – before I save off to the DB, and displays a validation error.

If I save, by not checking otherNamesUsed (which by passes the validation), and come back in and check this otherNamesUsed, only the input custom runs and validates. The radio custom never runs again.

    nameChanged: {
        type: String,
        optional: true,
        allowedValues: ["No", "Yes"],
        custom: function () {
          if (this.field('otherNamesUsed').value === "Yes" && (this.value === undefined)) {
            return "required";
          }
        }
    },
    otherName1First: {
        type: String,
        optional: true,
        custom: function () {
          if (this.field('otherNamesUsed').value === "Yes"
            && (this.value === null || this.value === "" || this.value === undefined)
          ) {
            return "required";
          }
        }
    }

Other names used

    otherNamesUsed: {
      type: String,
      optional: false,
      allowedValues: ["No", "Yes"]
    }

Radio control and input control

{{> afFieldInput name=nameChanged type="select-radio-inline" options="allowed" template="bootstrap3-horizontal"}}
{{> afFieldInput name=otherName1First placeholder=placeHolder template="bootstrap3-horizontal"}}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
aldeedcommented, Aug 31, 2016

@sptessier I realize your last comment was a long time ago, but I just wanted to mention that I gave up on the convertModifierToDoc approach because there are a lot of edge cases where I couldn’t figure out a good solution. If anyone can figure it out, I agree it would be a pretty slick way to support modifiers without people who use the package needing to be aware of the modifier itself. One idea might be to skip validation for tricky modifiers like $inc or $rename and you’d have to opt-in to use them otherwise it would just throw an error when you try to use them.

0reactions
aldeedcommented, Apr 11, 2018

The Meteor SimpleSchema package is no longer maintained other than critical fixes to keep it running with each latest Meteor release. Closing non-critical issues in this repo. Anyone who cares about this may do one or more of the following:

  • Switch to the NPM package. Be sure to adjust for the breaking changes. There can be a lot of work involved in switching, but it is worth the effort.
  • If this issue still occurs in the NPM package, submit an issue there. Be sure to include a link to a reproduction repo or a PR that adds a failing test for the issue.
  • If you have more time than money, submit a pull request to resolve any issue labeled “help wanted” in the NPM package repo.
  • If you have more money than time, donate to help support development if you are able
Read more comments on GitHub >

github_iconTop Results From Across the Web

Mystery: my custom C# attribute is used once, but constructed ...
I have this very simple unit test which uses a very simple custom Attribute. The attribute is added only to 1 class which...
Read more >
Writing Custom Attributes | Microsoft Learn
The primary steps to properly design custom attribute classes are as follows: Applying the AttributeUsageAttribute.
Read more >
Defining and Using Custom Attribute Classes in C#
Because you can create your own custom attribute classes and then act upon them, ... But Binaries (assemblies) aren't just for run-time.
Read more >
Add Custom Attributes to Active Directory Users
In this lecture you will learn how you can add custom attributes to your Active Directory user accounts. We are going to add...
Read more >
Creating Custom Attributes - powershell.one
A PowerShell attribute is a class that derives from the type [System. Attribute], so it takes only a few lines of code to...
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