履歴: プログラミング/Materialize

各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 4 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます

日時タイトル文字数追加削除内容差分基準
2018/3/9 11:27:14プログラミング/Materialize 最新版13,877+36 -7表示差分—
2018/3/8 19:52:09プログラミング/Materialize 12,849+349 -0表示差分選択
2018/3/8 11:39:28プログラミング/Materialize 2,511+108 -1表示表示中選択
2018/3/8 8:00:53プログラミング/Materialize 89— —表示—基準

基準: プログラミング/Materialize (2018/3/8 8:00:53) → 比較: プログラミング/Materialize (2018/3/8 11:39:28)

@@ -2,6 +2,113 @@
* validate の方法 [#baca2da5]
-これが良いみたい?
+これとか、
https://codepen.io/tdurant72/pen/vgyBjZ
+
+これとかのようにするみたい。
+
+http://demo.geekslabs.com/materialize-v1.0/form-validation.html
+
+jQuery.validate はこちら。
+
+https://jqueryvalidation.org/validate/
+
+** Validation ルール [#i324aa63]
+
+https://jqueryvalidation.org/documentation/#link-list-of-built-in-validation-methods
+
+標準的なルール:
+
+- required – Makes the element required.
+- remote – Requests a resource to check the element for validity.
+- minlength – Makes the element require a given minimum length.
+- maxlength – Makes the element require a given maximum length.
+- rangelength – Makes the element require a given value range.
+- min – Makes the element require a given minimum.
+- max – Makes the element require a given maximum.
+- range – Makes the element require a given value range.
+- step – Makes the element require a given step.
+- email – Makes the element require a valid email
+- url – Makes the element require a valid url
+- date – Makes the element require a date.
+- dateISO – Makes the element require an ISO date.
+- number – Makes the element require a decimal number.
+- digits – Makes the element require digits only.
+- equalTo – Requires the element to be the same as another one
+
+その他のルール:
+
+https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/additional-methods.js
+
+を読めば使える。
+
+https://github.com/jquery-validation/jquery-validation/tree/master/src/additional
+
+- accept
+- additional
+- alphanumeric
+- bankaccountNL
+- bankorgiroaccountNL
+- bic
+- cifES
+- cpfBR
+- creditcard
+- creditcardtypes
+- currency
+- dateFA
+- dateITA
+- dateNL
+- extension
+- giroaccountNL
+- greaterThan
+- greaterThanEqual
+- iban
+- integer
+- ipv4
+- ipv6
+- lessThan
+- lessThanEqual
+- lettersonly
+- letterswithbasicpunc
+- maxfiles
+- maxsize
+- maxsizetotal
+- mobileNL
+- mobileUK
+- netmask
+- nieES
+- nifES
+- nipPL
+- notEqualTo
+- nowhitespace
+- pattern - 正規表現
+- phoneNL
+- phonePL
+- phoneUK
+- phoneUS
+- phonesUK
+- postalCodeCA
+- postalcodeBR
+- postalcodeIT
+- postalcodeNL
+- postcodeUK
+- require_from_group
+- skip_or_fill_minimum
+- statesUS
+- strippedminlength
+- time
+- time12h
+- url2
+- vinUS
+- zipcodeUS
+- ziprange
+
+例えば、
+
+ LANG:javascript
+ $.validator.addMethod( "ipv4", function( value, element ) {
+ return this.optional( element ) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test( value );
+ }, "Please enter a valid IP v4 address." );
+
+こんな感じで独自ルールを追加できるので、とても便利だ。