SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MVC3 - search form validation via data annotations

    Hi, i have a search form on which i have text boxes, check boxes and drop down. I am already checking email and valid dates.

    On form submit, i want to make sure that atleast one item is selected. How can i do this best using data annotations?
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I think somebody might have written a custom validator to handle this scenario already, but the name isn't jumping out at me. In any case, it is probably doable with a custom validator and alot of code, but I would just write a little javascript and integrate it that way as these sorts of scenarios are pretty ugly with data annotations. Unless you like writing reflection code.

  3. #3
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I already have a jquery soution in place. Its fully dynamic and works for me.
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •