I am using MVC Foolproof validation package (https://foolproof.codeplex.com/) to verify if the alias is the same as what was entered for the username. For this i have created a custom validation class and i am using the NotEqualTo attribute like so on my properties
[Display(Name = "Choose a username*")]
public string Username { get; set; }
[Display(Name = "Choose an alias*")]
[NotEqualTo("Username", ErrorMessage = "alias is the same as username")]
public string Alias{ get; set; }
on my form i have the flowing for the input
<div class="form-group">
@Html.LabelFor(m => m.Alias, new { @class = "has-tooltip", aria_describedby = "alias" })
<div class="tooltip">
<i class="icon-info tooltip-toggle"></i>
<span class="tooltip-content" id="alias" role="tooltip">@Model.AliasHelpText</span>
</div>
@Html.TextBoxFor(m => m.Alias, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.Alias)
</div>
<div class="form-group">
@Html.LabelFor(m => m.Username, new { @class = "has-tooltip", aria_describedby = "username" })
<div class="tooltip">
<i class="icon-info tooltip-toggle"></i>
<span class="tooltip-content" id="username" role="tooltip">@Model.UsernameHelpText</span>
</div>
@Html.TextBoxFor(m => m.Username, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.Username)
</div>
When i input the exact same value (same case) in both the username and the alias the validation error message on the alias is triggered. However, when i enter the same value but with different casing e.g.
- username: myusername
- alias: Myusername
The validation doesn't trigger. How can i make this possible on the UI please? I have come across jquery.validator.addmethod but im struggling to understand it.
Thanks in advance