This repository has been archived by the owner on Jul 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #121 alternate text containing char ":"
The char ":" is used for splitting arguments in validation, but it shouldn't be split when it is part of an alternate text.
- Loading branch information
1 parent
30e5f75
commit 2f8570b
Showing
7 changed files
with
140 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
var myApp = angular.module('myApp', ['ghiscoding.validation', 'pascalprecht.translate']); | ||
// -- | ||
// configuration | ||
myApp.config(['$compileProvider', function ($compileProvider) { | ||
$compileProvider.debugInfoEnabled(false); | ||
}]) | ||
.config(['$translateProvider', function ($translateProvider) { | ||
$translateProvider.useStaticFilesLoader({ | ||
prefix: '../../locales/validation/', | ||
suffix: '.json' | ||
}); | ||
// load English ('en') table on startup | ||
$translateProvider.preferredLanguage('en').fallbackLanguage('en'); | ||
$translateProvider.useSanitizeValueStrategy('escapeParameters'); | ||
}]); | ||
|
||
// -- | ||
// Directive | ||
myApp.controller('CtrlDirective', ['ValidationService', function (ValidationService) { | ||
var vmd = this; | ||
vmd.model = {}; | ||
|
||
// use the ValidationService only to declare the controllerAs syntax | ||
var vs = new ValidationService({ controllerAs: vmd }); | ||
|
||
vmd.input6 = "initialInput6"; | ||
vmd.mylocation = { Name: "initialName", Name2: "initialName", Simple: "initialName" }; | ||
|
||
vmd.submitForm = function() { | ||
if(vs.checkFormValidity(vmd.form1)) { | ||
alert('All good, proceed with submit...'); | ||
} | ||
} | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!DOCTYPE html> | ||
<html ng-app="myApp" ng-strict-di ng-cloak=""> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Angular-Validation with Custom Javascript function</title> | ||
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="../../style.css"> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h2>Example of Angular-Validation with Custom Javascript function</h2> | ||
|
||
<div ng-controller="CtrlDirective as Location"> | ||
<div class="row"> | ||
<div> | ||
<form class="form-horizontal" name="locationForm" novalidate ng-model-options="{ updateOn: 'blur' }"> | ||
|
||
<section class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> | ||
<label class="labels" for="name">Name *</label> | ||
<input type="text" | ||
name="name" | ||
id="name" | ||
validation="required|max_len:50" | ||
debounce="0" | ||
ng-model="Location.mylocation.Name" | ||
class="form-control input-lg input-full" | ||
placeholder="Enter Location Name"> | ||
</section> | ||
<section class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> | ||
<label class="labels" for="name">Simple Input *</label> | ||
<input type="text" | ||
name="simple" | ||
id="simple" | ||
validation="required|max_len:50" | ||
debounce="0" | ||
ng-model="Location.mylocation.Simple" /> | ||
</section> | ||
</form> | ||
<h3>Control below NOT in a form, doesn't have problem</h3> | ||
<!--// NOT in form--> | ||
<section class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> | ||
<label class="labels" for="name2">Name2 *</label> | ||
<input type="text" | ||
name="name2" | ||
id="name2" | ||
validation="required:alt=Please Enter Name|max_len:50" | ||
debounce="0" | ||
ng-model="Location.mylocation.Name2" | ||
class="form-control input-lg input-full" | ||
placeholder="Enter Location Name"> | ||
</section> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<!-- external librairies CDN --> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-route.js"></script> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-sanitize.js"></script> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.js"></script> | ||
|
||
<!-- angular-translate --> | ||
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate --> | ||
<script src="../../vendors/angular-translate/angular-translate.min.js"></script> | ||
<script src="../../vendors/angular-translate/angular-translate-loader-static-files.min.js"></script> | ||
|
||
<!-- IBAN external library --> | ||
<script src="../../vendors/iban/iban.js"></script> | ||
|
||
<!-- Angular-Validation --> | ||
<script type="text/javascript" src="../../dist/angular-validation.min.js"></script> | ||
<!-- | ||
<script type="text/javascript" src="../../src/validation-directive.js"></script> | ||
<script type="text/javascript" src="../../src/validation-service.js"></script> | ||
<script type="text/javascript" src="../../src/validation-common.js"></script> | ||
<script type="text/javascript" src="../../src/validation-rules.js"></script> | ||
--> | ||
|
||
<!-- my application --> | ||
<script type="text/javascript" src="app.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters