Questions tagged [client-side-validation]

If the user is working with a browser that supports dynamic HTML (DHTML), Validation can perform validation using client script. It can provide immediate feedback without a round trip to the server

512 questions
41
votes
14 answers

Why is client-side validation not enough?

I saw here that: As you probably already know, relying on client-side validation alone is a very bad idea. Always perform appropriate server-side validation as well. Could you explain why server-side validation is a must?
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
33
votes
3 answers

IValidatableObject in MVC3 - client side validation

With MVC3 you have two new mechanisms for adding custom validation. These are (1) subclass ValidationAttribute or (2) implement IValidatableObject. The ValidationAttribute allows you to add client side validation relatively simply by implementing…
Paul Hiles
  • 9,558
  • 7
  • 51
  • 76
32
votes
2 answers

.Net Mvc 3 Trigger (other than submit button) Unobtrusive Validation

What I would Like I would like to trigger client-side validation in my View with an event of my choice. It could be 'onblur' maybe another button but something other than the submit button. Relevant Links How to trigger validation without using a…
27
votes
3 answers

RegularExpressionAttribute - How to make it not case sensitive for client side validation?

I have a string that I use for client side validation: private const String regex = @"^(?:\b(?:\d{5}(?:\s*-\s*\d{5})?|([A-Z]{2})\d{3}(?:\s*-\s*\1\d{3})?)(?:,\s*)?)+$"; I use this string in my [RegularExpression(regex, ErrorMessage = "invalid")]…
Scott Baker
  • 10,013
  • 17
  • 56
  • 102
24
votes
4 answers

Require validation only if the field is visible

I am using the [Required] attribute for the client-side validation in ASP.NET MVC 3. The class looks as: public class User { [Required(ErrorMessage = "First Name is required")] public string FirstName { get; set; } } I want the field…
24
votes
7 answers

Scala-JS for real web project

Has someone used Scala-JS in real web project but not only for plain JavaScript replacement in isolated env ? I would like to use Scala as much as possible (I wish I could). And seems Scala-JS claims to be that lib I could use (now) or in the…
ses
  • 13,174
  • 31
  • 123
  • 226
21
votes
2 answers

ASP.NET MVC data annotations client side validation with inherited RegularExpressionAttribute

To keep my model validation clean I would like to implement my own validation attributes, like PhoneNumberAttribute and EmailAttribute. Some of these can favorably be be implemented as simple classes that inherit from…
15
votes
3 answers

Asp.Net MVC EnableClientValidation doesn't work

I want as well as Client Side Validation as Server Side Validation. I realized this as the following: Model: ( The model has a DataModel(dbml) which contains the Test class ) namespace MyProject.TestProject { …
15
votes
5 answers

Rails 4 client side validation

Since upgrading my site to Rails 4, the client-side-validations gem has stopped working for me. I have had a look at the various alternatives such as jquery-validation-rails and judge, which involve writing quite a bit of javascript, especially for…
14
votes
2 answers

Javascript form-validation framework: Request for Review

I wasn't sure if I could ask this kind of question, but after seeing this on Meta Stackoverflow, it looks like this kind of question is ok. Well, onto my question: A few months ago I wrote a validation framework in Javascript. I know that there…
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
13
votes
5 answers

Why do we need both client side and server side validation?

One argument for using both client side validation (JavaScript) and server side validation using a validator is that if the client browser does not support JavaScript or JavaScript has been turned off deliberately, then client side validation is…
13
votes
6 answers

How to validate radio button using javascript

Need to validate a radio button input, i.e. when submit button is pressed and no radio buttons have been selected, it alerts the user saying 'please select a check box', and if a radio button has been selected then simply submit the form, needs no…
user1359421
12
votes
2 answers

ASP.Net Mvc Fixed-Length String Data Annotation

How can I set the string validation for a fixed-length string using data annotation ? I want to have a property on my model with the exact 10 string-length. I'm counting the seconds for help.
12
votes
5 answers

Why is client-side validation a security risk as opposed to server-side validation?

I don't quite understand why client side validation is a potential security risk or more of a security risk than server side validation? Can someone give me some scenarios?
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
11
votes
6 answers

Unobtrusive Client side validation in MVC4 not working

I have layout page with all scripts as shown below. My Site
user2232861
  • 273
  • 2
  • 10
  • 27
1
2 3
34 35