CKEDITOR.dialog.validate
The namespace with dialog helper validation functions.
Filtering
Methods
-
cssLength( msg ) → Function
CKEDITOR.dialog.validate#cssLength
Checks if a dialog UI element value is a correct CSS length value.
It allows
px
,em
,ex
,in
,cm
,mm
,pt
,pc
units.CKEDITOR.dialog.validate.cssLength( 'error!' )( '10pt' ) // true CKEDITOR.dialog.validate.cssLength( 'error!' )( 'solid' ) // error!
Parameters
msg : String
Validator error message.
Returns
Function
Validation function.
-
equals( value, msg ) → Function
CKEDITOR.dialog.validate#equals
Checks if a dialog UI element value and the given value are equal.
CKEDITOR.dialog.validate.equals( 'foo', 'error!' )( 'foo' ) // true CKEDITOR.dialog.validate.equals( 'foo', 'error!' )( 'baz' ) // error!
Parameters
value : String
The value to compare.
msg : String
Validator error message.
Returns
Function
Validation function.
-
functions( validators, [ msg ], [ relation ] ) → Function
CKEDITOR.dialog.validate#functions
Performs validation functions composition.
CKEDITOR.dialog.validate.functions( CKEDITOR.dialog.validate.notEmpty( 'Value is required.' ), CKEDITOR.dialog.validate.number( 'Value is not a number.' ), 'error!' );
Note: validation functions should return
true
value for successful validation. Since 4.19.1 this method does not coerce return type to boolean.Parameters
validators : Function
Validation functions which will be composed into a single validator.
[ msg ] : String
Error message returned by the composed validation function.
[ relation ] : Number
Indicates a relation between validation functions. Use CKEDITOR.VALIDATE_OR or CKEDITOR.VALIDATE_AND.
Defaults to
CKEDITOR.VALIDATE_OR
Returns
Function
Composed validation function.
-
htmlLength( msg ) → Function
CKEDITOR.dialog.validate#htmlLength
Checks if a dialog UI element value is a correct HTML length value.
It allows
px
units.CKEDITOR.dialog.validate.htmlLength( 'error!' )( '10px' ) // true CKEDITOR.dialog.validate.htmlLength( 'error!' )( 'solid' ) // error!
Parameters
msg : String
Validator error message.
Returns
Function
Validation function.
-
inlineStyle( msg ) → Function
CKEDITOR.dialog.validate#inlineStyle
Checks if a dialog UI element value is a correct CSS inline style.
CKEDITOR.dialog.validate.inlineStyle( 'error!' )( '' ) // true CKEDITOR.dialog.validate.inlineStyle( 'error!' )( 'height: 10px; width: 20px;' ) // true CKEDITOR.dialog.validate.inlineStyle( 'error!' )( 'test' ) // error!
Parameters
msg : String
Validator error message.
Returns
Function
Validation function.
-
integer( msg ) → Function
CKEDITOR.dialog.validate#integer
Checks if a dialog UI element value is an Integer.
CKEDITOR.dialog.validate.integer( 'error!' )( '123' ) // true CKEDITOR.dialog.validate.integer( 'error!' )( '123.321' ) // error!
Parameters
msg : String
Validator error message.
Returns
Function
Validation function.
-
notEmpty( msg ) → Function
CKEDITOR.dialog.validate#notEmpty
Checks if a dialog UI element value is not an empty string.
CKEDITOR.dialog.validate.notEmpty( 'error!' )( 'test' ) // true CKEDITOR.dialog.validate.notEmpty( 'error!' )( ' ' ) // error!
Parameters
msg : String
Validator error message.
Returns
Function
Validation function.
-
notEqual( value, msg ) → Function
CKEDITOR.dialog.validate#notEqual
Checks if a dialog UI element value and the given value are not equal.
CKEDITOR.dialog.validate.notEqual( 'foo', 'error!' )( 'baz' ) // true CKEDITOR.dialog.validate.notEqual( 'foo', 'error!' )( 'foo' ) // error!
Parameters
value : String
The value to compare.
msg : String
Validator error message.
Returns
Function
Validation function.
-
number( msg ) → Function
CKEDITOR.dialog.validate#number
Checks if a dialog UI element value is a Number.
CKEDITOR.dialog.validate.number( 'error!' )( '123' ) // true CKEDITOR.dialog.validate.number( 'error!' )( 'test' ) // error!
Parameters
msg : String
Validator error message.
Returns
Function
Validation function.
-
regex( regex, msg ) → Function
CKEDITOR.dialog.validate#regex
Checks if a dialog UI element value meets the regex condition.
CKEDITOR.dialog.validate.regex( /^\d*$/, 'error!' )( '123' ) // true CKEDITOR.dialog.validate.regex( /^\d*$/, 'error!' )( '123.321' ) // error!
Parameters
regex : RegExp
Regular expression used to validate the value.
msg : String
Validator error message.
Returns
Function
Validation function.