how to use multiple AdditionalFields in remote validation - asp.net mvc
Asked Answered
W

1

31

I need to validate the duplicate of FirstName, LastName and Email Address combination using remote validation in my ASP.NET MVC 4 (C#) application. The Remote Validation accepts only one AdditionalFields, which is as below:

 [Remote("IsUserNameAvailable", "User", AdditionalFields="LastName" )]
 public string FirstName{ get; set; }
 public string LastName{ get; set; }
 public string EmailAddress{ get; set; }

How can i add the EmailAddress for the combination?

Workingman answered 8/11, 2011 at 6:47 Comment(0)
L
54

You could separate them by comma:

[Remote("IsUserNameAvailable", "User", AdditionalFields="LastName,EmailAddress" )]
Lute answered 8/11, 2011 at 7:5 Comment(1)
N.B. If you want this to actually be revalidated when the additional fields change you will want to look at @Kiff's answer here #10164183Popinjay

© 2022 - 2024 — McMap. All rights reserved.