Demóstenes García G.

  • Archive
  • RSS

Validar nombre completo con jQuery Validation

Hace mucho que no escribo un post medio “técnico”, pero me topé con una cuestión bastante interesante: tendría que validar un campo (input) para verificar si el valor escrito dentro correspondía a un nombre completo (Nombre + Apellido).

Siempre he utilizado jQuery Validation, me parece un excelente plugin, por lo que decidí utilizar el mismo para validar el campo de igual manera. Este plugin tiene un método llamado “addMethod” que permite expandir y agregar nuevos métodos para validación.

La idea más sencilla era utilizar expresiones regulares y es que fácilmente debíamos tener algo como [texto]+[espacio]+[texto al menos una vez]. Ya la expresión regular la había hecho (con mucho esfuerzo, soy pésimo con RegExp, sinceramente) para el formulario de registro de Panagamers, así que era sólo de implementar dentro de jQuery (JavaScript) con el plugin de jQuery Validation.

HTML

JavaScript (jQuery)

    • #jquery
    • #validation
    • #plugins
    • #regex
  • 1 year ago
  • 7
  • Comments
  • Permalink
  • Share
    Tweet

7 Notes/ Hide

  1. mystonyfieldex liked this
  2. certificationex liked this
  3. theresaup liked this
  4. francesuy56 liked this
  5. demogar posted this

Recent comments

Blog comments powered by Disqus
← Previous • Next →

Portrait/Logo

About

I'm a 24 years old Electronics Engineering Student, Developer and Gamer.

I work for Admios as a RIA/Flex developer, I founded Pixmat where we mainly do web development and I developed Panagamers, the biggest and most important gaming community in Panama.

Me, Elsewhere

  • @demogar on Twitter
  • Facebook Profile
  • demogar on Vimeo
  • demogar on Youtube
  • demogar on Flickr
  • demogar on Delicious
  • demogar on Last.fm
  • demogar on Grooveshark
  • demogar on Foursquare
  • demogar on Gowalla
  • My Skype Info
  • Linkedin Profile
  • demogar on github

Twitter

loading tweets…

Following

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr