Click here to Skip to main content
15,919,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am using anchor tag in my view in and open a popup through jquery on clicking on that anchor tag.
<a href="#" id="guarantor-link">@Model.Guarantor</a>

I want to apply required validation on the that anchor tag.
Its default value is select.
Please help how can I do that?
I have tried different solutions, but they didn't help me out.
Zoltán Zörgő 18-Dec-12 8:07am    
Validation has meaning for user input only. As clicking on a link can be treated as user input, validation makes sense (but not with DataAnnotation), but I can not figure out what exactly you want:
- on what user action
- what data should be checked
- and what values can be accepted as valid

BTW: legacy anchor syntax is (not supported in html5), but any visible element with id can be used as anchor.

1 solution

You don't need to use data annotation for validating this. Please write javascript or jquery script for validating this.
else add a hidden field with the property @Model.Guarantor and put required attribute for that property.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900