CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Sun, 17 Aug 2025 09:46:29 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100217101933
location: https://web.archive.org/web/20100217101933/https://github.com/mcurry/js_validate
server-timing: captures_list;dur=0.625994, exclusion.robots;dur=0.025280, exclusion.robots.policy;dur=0.012785, esindex;dur=0.012984, cdx.remote;dur=76.925695, LoadShardBlock;dur=351.418545, PetaboxLoader3.datanode;dur=118.569097, PetaboxLoader3.resolve;dur=37.589638
x-app-server: wwwb-app219
x-ts: 302
x-tr: 462
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app219; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Sun, 17 Aug 2025 09:46:29 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Wed, 17 Feb 2010 10:19:33 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "8cca8c57b92cc4d25734a84f5b2c2aa0"
x-archive-orig-x-runtime: 160ms
x-archive-orig-content-length: 27922
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: windows-1250
memento-datetime: Wed, 17 Feb 2010 10:19:33 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Mon, 03 Aug 2009 13:24:05 GMT", ; rel="prev memento"; datetime="Thu, 07 Jan 2010 01:06:11 GMT", ; rel="memento"; datetime="Wed, 17 Feb 2010 10:19:33 GMT", ; rel="next memento"; datetime="Tue, 13 Apr 2010 05:32:06 GMT", ; rel="last memento"; datetime="Sun, 08 Jun 2025 18:28:58 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_14_20100217051750_crawl103-c/51_14_20100217101847_crawl101.arc.gz
server-timing: captures_list;dur=0.541063, exclusion.robots;dur=0.020148, exclusion.robots.policy;dur=0.009827, esindex;dur=0.011362, cdx.remote;dur=18.230017, LoadShardBlock;dur=190.047620, PetaboxLoader3.datanode;dur=135.444768, PetaboxLoader3.resolve;dur=173.620839, load_resource;dur=174.091274
x-app-server: wwwb-app219
x-ts: 200
x-tr: 448
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
mcurry's js_validate at master - GitHub
This service is courtesy of Pledgie.
mcurry / js_validate
- Source
- Commits
- Network (6)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
Branches (1)
- master ✓
- Tags (0)
Sending Request…
Enable Donations
Pledgie Donations
Once activated, we'll place the following badge in your repository's detail box:
CakePHP Plugin - Convert model validation rules to JavaScript and apply on the frontend using jQuery — Read more
name | age | message | |
---|---|---|---|
![]() |
README | Mon Jan 11 13:49:36 -0800 2010 | added catch option [mcurry] |
![]() |
controllers/ | Tue Jan 05 07:41:41 -0800 2010 | fixed whitespace [mcurry] |
![]() |
js_validate_app_controller.php | Fri May 01 18:53:30 -0700 2009 | added a ton of unit test [unknown] |
![]() |
js_validate_app_model.php | Fri May 01 18:53:30 -0700 2009 | added a ton of unit test [unknown] |
![]() |
models/ | Fri May 01 22:32:11 -0700 2009 | finished unit tests [unknown] |
![]() |
tests/ | Mon Jan 25 17:47:32 -0800 2010 | better notEmpty and checkbox handling [mcurry] |
![]() |
vendors/ | Mon Jan 25 17:47:32 -0800 2010 | better notEmpty and checkbox handling [mcurry] |
![]() |
views/ | Mon Jan 25 17:47:32 -0800 2010 | better notEmpty and checkbox handling [mcurry] |
README
/* * CakePHP jQuery Validation Plugin * Copyright (c) 2009 Matt Curry * www.PseudoCoder.com * https://github.com/mcurry/js_validate/ * https://sandbox2.pseudocoder.com/demo/validation * * @author mattc <matt@pseudocoder.com> * @license MIT * */ /* Notes */ * This helper requires jQuery. Sorry to all you Prototype/script.aculo.us users. * Tested on CakePHP 1.2.5 Stable and jQuery 1.3.2 /* ReadMe */ 1. Download the plugin and put it in /app/plugin/js_validate 2. Optionally, put jquery.validation.min.js somewhere in your /app/webroot/js. 3. Include the helper in any controller that will need it. var $helpers = array('JsValidate.Validation'); 4. Include the Javascript files in your view. If you are already using jQuery throughout your app, and it is included in your layout, you can removed it from the line below. If you copied jquery.validation.min.js to your /app/webroot/js: $javascript->link(array('jquery', 'jquery.validation.min'), false); Alternatively, you can use the JavaScript right from the in the plugin directory: $javascript->link(array('jquery', '/js_validate/js/jquery.validation'), false); The downside to using this method is the javascript is loaded through PHP, which isn't as fast. 5. Then in the views for your forms, call the helper. Replace "Model" with the model name for the form. echo $validation->bind('Model'); /* Extra */ 1. You can pass a second param to the method call above, which is an array of options. The available options are: * form - Any valid jQuery selector. Defaults to "form". If you wanted to target a form you'd most likely pass "#formId" * inline - Setting this to true will return the ouput for direct echoing. If false then the codeblock will be added to the output of $scripts_for_layout for display in the HEAD tag. * messageId - The id of a div where all the validation messages will be displayed. 2. If a particular field fails the input will be marked with the css class "form-error" and the message will be added after the field with the class "error-message". This is the same as Cake would do if you submitted to the server. In addition you can specify a div messageId and all the messages will be shown there as well. <div id="message"></div> /* Custom Rules and Error Handling */ 1. At the moment there are three callbacks: beforeFilter, setError and afterFilter. beforeFilter - called before validation is started. No params. afterFilter - called after validation is done. Passed an array of errors. setError - called anytime a validation error is found. Passed the field and the error message. If you wanted some alternate handling for errors you could do something like this: $.fn.validate.setError = function(field, message) { //don't ever do this or I will come for you alert(message); } 2. It's up to you to write the custom function and you're free to use Ajax here. For example if you had a custom validation rule ?myRule? you would define the function like this: $.fn.validate.myRule= function(val, params) { //do some validation here and return either true or false. } /* Manual Form Handling */ You can disable the auto binding to the form by adding setting the catch option to false: echo $validation->bind('Model', array('catch' => false)); Then catch the submit and run the validation manually: $("#ModelForm").submit(function(event) { //your own code here //run the validation valid = $.fn.validate($(this).data("validation")); //more code return valid; } /* Tests */ 1. CakePHP unit tests are available through the normal /test.php 2. JavaScript unit test can be run by visiting /js_validate/test. /* Tips */ * I wrote an article for PHPArch about JavaScript validation(https://c7y.phparch.com/c/entry/1/art,improved_javascript_validation), which raised some concerns that this approach may reveal too much about an application's security. If this is a concern for you, but you still want to use this helper, there is an option to whitelist rules can be applied on the client side. To use to this feature set the list in your bootstrap.php: Configure::write('javascriptValidationWhitelist', array('alphaNumeric', 'minLength'));