Skip to main content
0votes
1answer
28views

Why doesn't ASP.Net MVC client side validation trigger where input is outside form element, but linked via form="formid" attribute?

I am using ASP.Net 8.0 MVC... ScenarioName property has a Required attribute in the Model.. When I use the following, clicking submit button with all of these elements wrapped inside the form tag ...
RyanO's user avatar
0votes
1answer
34views

MVC disabling client side validation on a model field

I have a model for creating/editing items and the items can belong to a category. The category renders as a drop down so the user can choose a category, or fill in a new category via a textbox. The ...
andrewb's user avatar
  • 3,093
0votes
1answer
135views

MVC Core Validation - render as valid initially

I have an MVC 5 web app, and an MVC Core web app, and I am using unobtrusive validation in both. When you use TextBoxFor and ValidationMessageFor for a required property, the 2 apps behave ...
J. Lee's user avatar
0votes
1answer
71views

c# mvc how to validate 3rd column Value Based on Two column

Here I have three properties Like Public Class Addition{ public Int Val1{get;se;} public Int Val2{get;se;} public Int Val3{get;se;} } In .cshtml Val1=10;Val2=20; If User Entre Val3=30 Then How can i ...
user avatar
0votes
2answers
619views

Jquery email validation is not working in MVC

I'm using this code in mvc for email validation but after we typed @ of any text in textbox for example : abc@ after @ validation is not wokring and form is submit without validation error. if (!...
Zaheen's user avatar
0votes
1answer
658views

ASP.NET MVC Html Helper: Adding a validation in an enum ddl

I'm pretty new in ASP.NET MVC. And I'm very sorry for this question. What my goal is: To add a validation using Html Helper of ASP.NET MVC on an enum ddl. Model public enum SampleEnum { Active ...
Josh's user avatar
  • 223
0votes
1answer
100views

mvc validationMessage is not working while its in IEnumerable<T>

I have a class : public class Cust { [Required(ErrorMessage ="NameField Req")] public string Name { get; set; } } I use this class : public class CustModel { public IEnumerable<Cust&...
user avatar
0votes
0answers
493views

Model object is not validated if a member is invalid

I'm writing an ASP.NET Core web app. I'm using MVC's model validation framework, and I have a "form" model that contains a Product object and a IsCreationMode boolean. I want to validate the Product,...
Simone's user avatar
  • 1,336
2votes
0answers
70views

ASP.NET MVC validation message does not display error message [duplicate]

I have looked at my code and endless examples and looked at other questions as well, but nothing I try works for me. I am trying to validate my view. The field border is red on submit but the error ...
user avatar
0votes
1answer
2kviews

Required field validator for a textbox in MVC depend on a dynamically generated drop down list

I'm generating some controls with the help of a for-each loop. I would like to validate the textbox depend on the answer of the dropdown. For some questions, validator should be enabled if the ...
kas_miyulu's user avatar
5votes
0answers
174views

Cross-site scripting (XSS) patterns can be submitted

Cross-site scripting (XSS) patterns can be submitted. [HttpPost] [AllowAnonymous] [ValidateInput(false)] public async Task<string> Index(string Xml) => await Process(Xml); If i remove ...
Rahul's user avatar
-1votes
1answer
123views

Radio button validation before post

I want to ensure that a user picks an answer to the question being asked. I have tried JQuery, Custom Validation class, setting model attributes to required. To summarise, if no radio button is ...
The OrangeGoblin's user avatar
1vote
1answer
647views

ModelState.AddModelError - How can I makeup the Resource error string

I have a ASP.NET MVC5 project where I do some input validation over more then 1 field. When an error is found I add an error to the model via : ModelState.AddModelError("field", Resource.ErrorMessage)...
kahoona's user avatar
0votes
0answers
234views

How to validate input text for integers and decimals only?

I cannot find the right answer for my case, so I posted my question here. I'm validating the form in ASP.NET MVC and looking for the way to validate a text field to allow only numeric and decimal ...
gene's user avatar
  • 2,108
1vote
1answer
3kviews

How to manually add MVC client-side validation?

I'm using jquery (unobtrusive) validation for MVC, and I have a field that is not a part of my model, so I'd rather not add it JUST to give it some data annotations. And, all I need is to ensure that ...
Nathan Childers's user avatar

153050per page
close