My forms have inputs with default helper text that guides the user on what to enter (rather than using labels). This makes validation tricky because the input value is never null.
How can I extend unobtrusive validation to handle this? The form shouldn't be valid if the Name input is equal to "Please enter your name..."
I started reading Brad Wilson's blog post on validation adapters, but I'm not sure if this is the right way to go? I need to be able to validate against different default values depending on the field.
Thanks
Yes thats the right way to go. You should implement your own atribute and implement IClientValidatable
.
You could also have a required boolean value set initially to false
as a hidden form field. When the user changes the textbox, set it to true.