Tagged Questions
2
votes
0answers
16 views
Customizing DefaultModelBinder validation messages
I am trying to replace the default validation messages in MVC3 that are displayed when you fail to fill in a required field or fill in an invalid value. I am only addressing server-side validation in ...
0
votes
2answers
27 views
Multiple forms on the same view (asp.net mvc)
Im trying to make a Wizard registration form (multistep registration) in asp.net mvc.
I have 2 methods on my controller (Login and Register) because I dont want that the URL changes.
Well, in the ...
1
vote
2answers
43 views
Client or server validation doesn't work with Data Annotations
I'm developing a MVC 4 application with Entity Framework 6 and encountered a problem with Data Annotations. No matter what annotation I use, it isn't validate.
I'm using the following view model to ...
1
vote
1answer
34 views
Compare attribute reference on property form another class C#
Can I use attribute compare for property, if property which I need for compare is in another class? I need something like this:
public class TestViewModel {
public User UserProfile { get;set;}
...
0
votes
2answers
43 views
Don't validate hidden field
I have some fields that are shown only depending on some conditions, it work's fine to show and hide field with Jquery
but these fields are validated on submit even if they are hidden, I have ...
0
votes
1answer
20 views
Handle validation of EF in windows form application
I am working with EF6 to create my model .So i create my comment model as you can see here . So for CommentText i put Required with its error message .When i use MVC ,it works fine and my errors ...
0
votes
2answers
68 views
unable to get property value of undefined or null reference
I am using below code to validate entered delivery date should not be less than today date .. for that purpose I have done below like this ....
I am using custom validation using jquery ...
this is ...
0
votes
0answers
55 views
asp.net mvc 4 model date validation using jquery
I have got below model date property that I need to validate for minimum is today date ....
the property is given below...
[UIHint("Date")]
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ...
1
vote
2answers
46 views
Html.ValidationMessage is empty despite message added to ModelState
I am trying to use the ModelState.AddErrrorModel and Html.ValidationMessage("Account") together, to show an error message.
However, even though I can debug the model error is being added on my POST, ...
0
votes
1answer
20 views
Access Controller context in custom ValidationAttribute
I'm implementing a custom validator by using a ValidationAttribute:
public class CustomAttribute : ValidationAttribute
{
protected override ValidationResult IsValid (object value, ...
0
votes
0answers
22 views
MVC Forms - Toggle Model Validation
I have an MVC form which allows user to add some details about a "service" related to their account. My problem is that they can save and resume this form whenever they want so I don't need to check ...
0
votes
0answers
27 views
Only one error message per custom validation in MVC?
I have not been able to find a definitive answer about this. In asp.net MVC 5, when some fields are required only if some condition is true, we will need to implement a custom validation attribute by ...
0
votes
1answer
28 views
How to change the default ErrorMessage for StringLength attribute in view model with unobtrusive validation
The default StringLength validation error message is too long for my purposes, so I would like to make it shorter.
I know I can specify the ErrorMessage for each property, but I rather not duplicate ...
4
votes
1answer
40 views
Is it possible to disable client side validation for a single model property in MVC
I have an MVC 4 model and am creating html from it in the view using @Html.TextBoxFor. In the model for one of the fields I have a RegularExpression attribute defined as follows:
...
2
votes
1answer
33 views
Create custom DataType Validation
I want to make my own validation class (i have a lot of validation methods in JS that i want to translate into C# to use with MVC models) that works exactly like data annotations do, validating in ...
0
votes
0answers
56 views
Adding mvc model validation attributes in runtime
I have an domain entity, Person, which has dynamic properties stored in a Dictionary
Each property has a Name, Value and can be of different types (enum) [Email,Number etc] a property can also be ...
1
vote
1answer
34 views
Asp.net MVC 4 Client Side Validation Not Work
Ajax.beginform validation only running in controller. I want validate model in client side .
Example helpers :
<label class="control-label">@Html.DisplayNameFor(Function(m) ...
1
vote
2answers
51 views
Immediately validate email fields on client side
I have the following property in my view model:
[EmailAddress]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
And render this with the following razor view:
@Html.LabelFor(m ...
0
votes
0answers
18 views
We get “Validation type names in unobtrusive client validation rules must be unique” after a while in production
We have an ASP.net MVC 3 app with models using the data annotation validation attributes and we have unobtrusive client validation turned on. For the most part this is fine, but after a couple of ...
0
votes
0answers
11 views
ASP.NET MVC : When Bundles is enabled, a Uncaught ReferenceError is thrown (JavaScript)
In release mode, or when I force the BundleOptimization, I cannot understand why when I write
jQuery.validator.unobtrusive.parse('#FormModificationSoc');
an exception is thrown and my javascript as ...
0
votes
1answer
28 views
Can't validate TinyMCE 4 control in MVC4
I'm using MVC4 with knockoutjs (with mapping plugin) and the binding plugin for tinymce (which defines the "wysiwyg" binding to associate a textarea to a TinyMCE editor) . Everything works fine except ...
0
votes
1answer
54 views
Asp.net MVC 5 model validation regex not validating special characters
I have using ASP.NET MVC 5 and for validation I am using the regular Jquery unobtrusive validation library.
Currently I am facing an issue, The regular expression validation is working all right on ...
1
vote
1answer
17 views
Custom “Unique Check” ValidationAttribute prevents Edits to Model
I created a custom ValidationAttribute to check if a created Activity is Unique.
public class UniqueAttribute : ValidationAttribute
{
protected override ValidationResult IsValid (object value, ...
1
vote
1answer
68 views
ASP.NET MVC 5 Form Validation
I am new to ASP.NET MVC and using version 5. I created a form that is in the layout, and I cannot cannot get it to show validation errors on the view. It will post to the action correctly, and if the ...
0
votes
0answers
38 views
MVC server-side validation on decimal values
I've got a problem with validating a model server-side in MVC. My model has a number of fields and every single one of them validates fine. The only problem I have is with two decimal fields:
...
0
votes
0answers
23 views
asp.net mvc5 devexpress validation summary - class level validation attributes
I am using asp.net with mvc 5 and devexpress. I am trying to use the validation summary of devexpress but I want to restrict it to show only the class level validation errors. So the property level ...
0
votes
0answers
25 views
mvc - date validation - data annotation - client validation fails
I use
[DataType(DataType.Date), DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
to validate date input, but the validation only happens on server side, client ...
0
votes
1answer
37 views
Client-side validation when changing input ids in asp.net mvc
I'm currently working on a form which can contain multiple instances of a sub-form. The main entry 'publication form' contains multiple instances of a sub-page 'publication.' I'm doing this using ...
1
vote
0answers
47 views
Why would validator take my old error message and not the new error message?
I am using MVC5, which contains a form with the following fields:
StudentType - Radio button
GradId - dropdown
HSYearofGradId - dropdown
CollegeStatusId - dropdown
With those fields, I want to ...
2
votes
1answer
57 views
MVC DataAnnotations validation (Regular Expression) User Input Not Allow HTML Entities
I have textarea multiline, I want to user not allow enter html tags and html entities in textarea, I done with html tags not allow but difficulty with user input html entities.
Below code works when ...
0
votes
1answer
53 views
FromDate ToDate clientside validation using foolproof in MVC not working
I have two date field in my Page fromDate and ToDate. ToDate should be greater than FromDate. I need to validate it in client side.
I'm using Foolprof for clied side validation
reference added
...
0
votes
1answer
32 views
Validate one field only if another field is over a certain amount?
I have to validate a field only if a previous field is $0.01 or more. I am using asp.net mvc to code this. My page looks like this:
<div class="form-group">
@Html.LabelFor(m ...
0
votes
1answer
21 views
Client side validation of L18N dates always fails for non-browser locale date formats
I have a date field in asp.net mvc form which is using client side validation.
I want it to accept dates according to the currently selected culture of the site but it always fails for anything other ...
0
votes
1answer
103 views
validation on mvc dropdown values?
I have created 5 dropdowns in mvc razor view using foreach. I need to do validation if same value gets selected in more than one dropdown in jquery.
I can easily do it using the dropdown id but what ...
0
votes
0answers
40 views
MVC File Upload Validation not working
I have the following in order to allow user to ONLY upload .jpg and .doc files. However is not required to upload file (hence I don't have [Required] in the model. However even though when I don't ...
0
votes
1answer
14 views
Validation of checkbox mvc
I realise this question has been asked before but I am still struggling with validating this checkbox using data annotations. What am I missing. As it is right now the checkbox is not validated
view ...
0
votes
1answer
41 views
Nullable int validation not showing message for non-numeric values
I'm using jQuery validation, and I have the following html:
<input data-val="true" data-val-number="The field Weight must be a number." data-val-range="The field Weight must be between 1 and 750." ...
0
votes
1answer
28 views
Validator, and input-validation-error
I do have a View bound to a model,
When I am using a built-in Validator on a property in the model, [EmailAddress] for instance, if I write something invalid, the html tag gets the class ...
0
votes
1answer
24 views
Custom validation in mvc
I have a dropdown list conatining some options. The last one is "other". When the user chooses the other option a textbox appears next to the drop down list. When the user chooses "other" he must ...
0
votes
0answers
36 views
MVC Validation with WYSIHTML5
I'm using the WYSIHTML5 plugin in an ASP.NET MVC View for a textarea called #Content.
This textarea uses the MVC built-in validation to mark it as a required field. However because the plugin uses an ...
2
votes
2answers
70 views
How do I allow empty value to be passed to MVC WebApi for a double type
I have a simple WebApi 2.1 project and am receiving a model state error when I post and leave the value for a non-required nullable field (double type) blank. I want to leave the xml element but ...
0
votes
1answer
29 views
Nullable Data type validation and IValidatableObject.Validate method
I have a Model like below
public class MyModel : IValidatableObject
{
[DisplayName("Property Name")]
[Range(0, 9999999, ErrorMessage = "Please enter a number between 0 and 9999999")]
...
0
votes
4answers
51 views
Validations in ASP.NET MVC
I am using ASP.NET MVC 4 in my current project with MS CRM as the backend. (Hence no entity framework). We have a series of very long pages (about 10-15) pages that the customer has to fill as part of ...
0
votes
1answer
16 views
Validate Html.DropDownListFor, not send detault value when httpPost
I'm having this dropDownListFor:
@Html.DropDownListFor(m => m.ChoosenThemeSetting, Model.ThemeSettings.Select(k => new SelectListItem { Text = k.ChoosenTheme, Value = k.ChoosenTheme, }), "-- ...
1
vote
1answer
70 views
How to deal with Model and ViewModel validation in ASP.Net MVC
I have an ASP.Net MVC application which contains Model and ViewModel, this app have UI and API interfaces which works through different controllers, UI works with ViewModel, API works with Model. ...
0
votes
1answer
39 views
How to validate multiple ViewModels in single view by condition using ModelState.IsValid
I have a problem with validation of one view with multiple ViewModels. My situation is, that I have one Basic form, which is same for lot of pages. By ID parameter, I render new external fields to ...
0
votes
0answers
23 views
Dismiss Spinner on Server Side Validation Error
Performed extensive searches - could not find a solution.
When a user selects "submit" on a form, I'd like to display a spinner. If there exists a validation error I'd like to dismiss the spinner so ...
1
vote
1answer
36 views
Server-Side validation MVC5 not using specific Culture
I am working on an MVC5 application. I am having a problem getting the server-side validation of number fields to work for the specific culture (de-CH). It really feels like it is defaulting to the ...
1
vote
1answer
34 views
Knockoutjs Validation issue - self.errors().length
I have included :
knockout.3.0.1.js
knockout.validation.debug.js
jquery.validate.js
Error is : (From Firebug)
TypeError: self.errors is not a function
Except validation all other code is ...
2
votes
0answers
69 views
Validation not fired on List<> parameter of controller method
Here is a snippet:
public class OrderItemModel
{
public int ID { get; set; }
public decimal Quantity { get; set; }
}
public class OrderMenuModel : List<OrderItemModel>, ...