{"id":19423765,"url":"https://github.com/limansky/lift-validate","last_synced_at":"2026-05-12T23:02:07.779Z","repository":{"id":17627872,"uuid":"20432122","full_name":"limansky/lift-validate","owner":"limansky","description":"Lift input validation module","archived":false,"fork":false,"pushed_at":"2015-07-07T22:29:37.000Z","size":274,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-07T18:56:43.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/limansky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-03T06:32:59.000Z","updated_at":"2019-07-23T09:10:35.000Z","dependencies_parsed_at":"2022-09-12T03:10:24.186Z","dependency_job_id":null,"html_url":"https://github.com/limansky/lift-validate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limansky%2Flift-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limansky%2Flift-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limansky%2Flift-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limansky%2Flift-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/limansky","download_url":"https://codeload.github.com/limansky/lift-validate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240604286,"owners_count":19827878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T13:40:42.027Z","updated_at":"2026-05-12T23:02:02.752Z","avatar_url":"https://github.com/limansky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lift Validate module\n\n  Input validation module for [Lift](http://liftweb.net) web framework.  This module use [jQuery Validation](http://www.jqueryvalidation.org) plugin for client side validation.  Server side validation is available as well.\n\n  Following validators are provided:\n\n  * ValidateRequired - value is required.\n  * ValidateNumber - value is a positive or negative number. You can also define minimum and maximum values.\n  * ValidateInt - the same with ValidateNumber, but the number must be integer.\n  * ValidateEmail - value must be valid email address.\n  * ValidateUrl - value must be valid URL.\n  * ValidateEquals - value must be the same with another value.\n  * ValidateRemote - value will be checked on server using passed function.  There is a problem with this validator because of jQuery Validation plugin behavior.  If validation was failed it will send validation requests to server on each value changed event, so it can increase server load.\n  * ValidateLength - value length must satisfy defined range.\n  * ValidateRegex - value must satisfy defined regular expression.\n\n## Installation\n\n  If you use sbt add the module to libraryDependencies. For example for Lift 2.5.x it will be:\n\n```\n  \"net.liftmodules\" %% \"validate_2.5\" % \"1.0\"\n```\n\n  Current development build status:\n  [![Build Status](https://travis-ci.org/limansky/lift-validate.svg?branch=master)](https://travis-ci.org/limansky/lift-validate)\n\n## Usage\n\n  In the simplest case the only thing you need to do is to add validators to you form snippet. For example you have form with name, email, password and password confirmation. The name must be longer than 6 characters, email is required and shall be correct and the password and confirmation shall match.\n\n```Scala\nimport net.liftmodules.validate.Validators._\n// implicit default context\nimport net.liftmodules.validate.global._\n\nclass MySnippet {\n\n  def save() = {\n      // save data\n  }\n\n  def render() = {\n\n      \"#name\" #\u003e (SHtml.text(name, name = _) \u003e\u003e ValidateRequired(() =\u003e name)\n                                             \u003e\u003e ValidateLength(Some(6), None, () =\u003e name)) \u0026\n      \"#email\" #\u003e (SHtml.text(email, email = _) \u003e\u003e ValidateRequired(() =\u003e email)\n                                                \u003e\u003e ValidateEmail(() =\u003e email)) \u0026\n      \"#passwd\" #\u003e SHtml.text(passwd, passwd = _) \u0026\n      \"#confirm\" #\u003e (SHtml.text(confirm, confirm = _) \u003e\u003e ValidateEquals(() =\u003e confirm, () =\u003e passwd, \"#passwd\")) \u0026\n      \"#save\" #\u003e SHtml.onSubmitUnit(save)\n  }\n```\n\n  To make jQuery module work you should include it in your HTML template:\n\n```html\n  \u003cscript src=\"/classpath/validate/jquery.validate.min.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n```\n\nIf you use ValidateInt or ValidateRegex you shall also inclide additional methods:\n\n```html\n  \u003cscript src=\"/classpath/validate/additional-methods.min.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n```\n\nIf you want to use jQuery plugin build-in localization, you can include required file from localization folder. For example, for Russian localization:\n\n```html\n  \u003cscript src=\"/classpath/validate/lozalization/messages_ru.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n```\n\n### Server side validation\n\n  If you want to check the values on the server side before saving you can do it using ValidationContext.  Here is the modified version of previous example:\n\n```Scala\nimport net.liftmodules.validate.Validators._\nimport net.liftmodules.validate.ValidationContext\n\nclass MySnippet {\n\n  implicit val context = ValidationContext()\n\n  def save() = {\n      if (context.validate()) {\n          // save data\n      } else {\n          // handle error\n      }\n  }\n\n  def render() = {\n      \"#name\" #\u003e (SHtml.text(name, name = _) \u003e\u003e ValidateRequired(() =\u003e name) \u003e\u003e ValidateLength(Some(6), None, () =\u003e name)) \u0026\n      ...\n  }\n```\n\n### Customizing messages\n\n  Each validator has additional parameter to pass a string which will be shown if validation is failed.\n\n### Setting jQuery plugin options\n\n  If you want to pass some options to jQuery validation plugin you can do it by setting Validate.options parameter in your Boot class.  Validate module provides two predefined set of options, for [Twitter Bootstrap](http://getbootstrap.com) 2 and 3. For example, for Bootstrap 3:\n\n```Scala\n  import net.liftmodules.validate.options._\n\n  Validate.options.default.set(Bs3Options())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimansky%2Flift-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimansky%2Flift-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimansky%2Flift-validate/lists"}