shinyvalidate icon indicating copy to clipboard operation
shinyvalidate copied to clipboard

"Basic Usage" example uses predicate function? I'd love that option.

Open alexkgold opened this issue 5 years ago • 0 comments

It looks like this was maybe an earlier form?

iv$add_rule("title", need, message = "A title is required")

TBH, if it's possible I'd love to have this form available. I'd love the option to supply either a function that returns a character OR a predicate function. If the predicate is TRUE, I can provide a string. I can see why this isn't great design, but I find myself wanting to do it.

For example, I wrote this

  iv$add_rule("n_students", function(x) x > 0)

only to realize I had to replace it with a clunkier function. It's unlikely my functions will be compact enough for me to want to write them as anonymous if they have to return a character.

alexkgold avatar Sep 02 '20 18:09 alexkgold