Results 1 to 2 of 2

Thread: should i use unobtrusive javascript in asp mvc instead of writing my own validation ?

  1. #1
    Join Date
    May 2013

    should i use unobtrusive javascript in asp mvc instead of writing my own validation ?

    The javascript code for client validations is already written from scratch and is perfectly working. But to make our solution more scalable and minimize lines we are thinking of replacing our Javascript client validations with the built in asp MVC support for unobtrusive javascript. However there are scenarios where its particularly disadvantageous. E.g. I want to validate a field with regex. and the field isnt directly bound to the model. But to implement unobtrusive javascript I need to bind it to some field i am creating in the model just for the purpose of validation(and not using it in my form submit) is there any way to achieve validation without binding a field to the model? and what would be the considerable advantages if i replace the javascript code with unobtrusive validations even if not for all scenarios?

  2. #2
    Join Date
    Jul 2008
    urbana, il
    i would use HTML5 validation; it's well-documented, bulletproof, and works well with accessibility. you can use polyfills to enforce the rules and requirements on older browsers without having to re-write your rules.
    It would be decoupled from asp.net's validation, and works even when javascript is disabled.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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