Click here to Skip to main content
12,945,945 members (60,463 online)
Rate this:
Please Sign up or sign in to vote.
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.
Posted 18-Nov-12 19:08pm
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,899
CHill60 3,205
Maciej Los 2,453
Jochen Arndt 1,935
ppolymorphe 1,795

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100