Questions tagged [expressiveannotations]

Annotation-based conditional validation library.

A small .NET and JavaScript library which provides annotation-based conditional validation mechanisms. Given attributes allow to forget about imperative way of step-by-step verification of validation conditions in many cases. Since fields validation requirements are applied as metadata, domain-related code is more condensed.

More details can be found on GitHub.

19 questions
2
votes
2 answers

RequiredIf conditional attribute in .net Core

How to achieve RequiredIf conditional operation in .NET Core for Model based validation. In ASP.NET MVC, had used with ExpressiveAnnotation package but its not working for .NET Core.
2
votes
0 answers

ExpressiveAnnotations: translate global _defaultErrorMessage in RequiredIfAttribute

I want to use inheritance for AssertThatAttribute and RequiredIfAttribute but is not possible because both classes are sealed classes public sealed class RequiredIfAttribute : ExpressiveAttribute public sealed class AssertThatAttribute :…
senzacionale
  • 20,448
  • 67
  • 204
  • 316
1
vote
1 answer

ExpressiveAnnotations RequiredIf Validation Firing When Tabbing to Field

I have a model that has two fields that use the RequiredIf validator (either Phone or Email is required): [RequiredIf("Phone == null", ErrorMessage = "Either Phone or Email is required")] public string Email { get; set; } [RequiredIf("Email ==…
JeffCren
  • 396
  • 1
  • 5
  • 15
1
vote
0 answers

Does https://github.com/jwaliszko/ExpressiveAnnotations support ASP.NET Core 2?

Using NuGet Package Manager I installed this: https://github.com/jwaliszko/ExpressiveAnnotations. However, VS2017 reported conflict as package requires .net 4.6.1 framework. Does this package support the ASP.NET Core 2 framework?
1
vote
1 answer

Expressive annotation rebind form after adding dom

I'm using expressive annotation on a form that contains list object. First load, everything works fine. There is a button, that allow to add object on this list. To add this object, I replace a part of the form with a partial view that was rendered…
1
vote
1 answer

ExpressiveAnnotations RequiredIf Client Side Validation

Installed EA for trying to have a parameter be required if there is nothing in the database, IE. this is the first time someone is creating something. However, the RequiredIf never fires for client side validation, even though when the model gets…
TLBB
  • 89
  • 1
  • 10
1
vote
0 answers

validate using ExpressiveAnnotations using AssertThat from different viewmodels

I'm trying to use ExpressiveAnnotations to validate my form. I have two viewmodels wherein the 2nd model is dependent to the 1st model. Is this possible using this library? Thank you. public class ViewModel { [Required] …
makoto
  • 177
  • 1
  • 4
  • 16
0
votes
1 answer

In Expressive Annotations using the AssertThat attribute - how to modify the error message at runtime or pass in string values

In Expressive Annotations, using the "AssertThat" attribute is it possible to modify the error message at runtime? I am working in ASP.NET MVC Classic environment and needed to add to my existing validations. The new validation would check that the…
Shiloh
  • 25
  • 5
0
votes
1 answer

Using model's property for requiredif statement without putting it in an actual DOM

I need to validate input field based on a property that is within the same model, however is not being used in the DOM. Something like so: [RequiredIf("NameRequired", ErrorMessage = "Name is required")] public string Name {get;set;} public…
0
votes
0 answers

Requirement based on a value from related table, ExpressiveAnnotations

I know I can make some logic based on the columns in the table/model like this: [RequiredIf("ColumnA == 1", ErrorMessage = "Error message")] But is it possible to make a required field if I want to make a check against a column in another…
Pomme
  • 87
  • 8
0
votes
1 answer

ExpressiveAnnotations.Attributes RequiredIf validation not working

I have the following validation not working and cannot resolve why that is the case? [Display(Name = "Bus")] [RequiredIf("SelectedWidgetText == 'Referral'", ErrorMessage = "Please select a Vehicle.")] public int DepotId{ get; set; } …
Baahubali
  • 4,604
  • 6
  • 33
  • 72
0
votes
1 answer

ExpressiveAnnotations error message on validation

After inserting the ExpressiveAnnotations (expressive.annotations.validate.js) into my application and triggering an input to be validated the browser shows a error message (see below). I don't think the Problem comes from my code rather a…
0
votes
1 answer
0
votes
1 answer

ExpressiveAnnotations and JqueryUI DatePicker not triggering client side validation

When I use the JQueryUI datepicker widget on a date field that was created with the following expressive annotation the client side validation is not triggered until I click in some other field, return to the date field and then exit the date field.…
John S
  • 7,909
  • 21
  • 77
  • 145
0
votes
1 answer

How do I prevent jquery validation from highlighting my fields when I unhide them?

On my forms I have numerous optional fields that are only needed if a prior checkbox or radio button value is supplied. To keep the form clean I'm hiding those additional fields until they're needed. The issue I'm having is when those fields are…
Brian Surowiec
  • 17,123
  • 8
  • 41
  • 64
1
2