Ticket #5996 (closed Bug: fixed)

Opened 4 years ago

Last modified 3 years ago

CKEDITOR.dialog.validate.functions is buggy.

Reported by: anrikun Owned by:
Priority: Normal Milestone:
Component: UI : Dialogs Version: 3.3.1
Keywords: Cc:

Description

I am pretty sure this method has never been tested as it absolutely does not work: it always returns true. So are CKEDITOR.dialog.validate.equals and CKEDITOR.dialog.validate.notEqual that rely on it.

Change History

comment:1 Changed 4 years ago by anrikun

  • Version set to 3.3.1

comment:2 Changed 4 years ago by Saare

  • Status changed from new to pending

Can you expand a bit more? Maybe attach a sample page to reproduce the issue?

comment:3 Changed 4 years ago by anrikun

CKEDITOR.dialog.validate is declared inside the dialog plugin plugin.js Its notEmpty method is the most used one, to check whether a required field has been filled in or not. E.g.

var validator = CKEDITOR.dialog.validate.notEmpty('You must fill myField!');
var isValid = validator.apply(myField);

CKEDITOR.dialog.validate another method, functions that is supposed to allow to create custom validators. The problem is that however you use it, it will always return true, thus validating nothing. E.g.

var validator = CKEDITOR.dialog.validate.functions(function() {
  return false;
}, 'this message should always been displayed but it will never be :-(');
var isValid = validator.apply(myField);

isValid will always get true although it should always get false!

This bug occurs because the arguments received by functions are not passed to the function this method returns. In the example above, function() {return false;} is the argument, and it will simply be ignored!

comment:4 Changed 3 years ago by j.swiderski

  • Status changed from pending to closed
  • Resolution set to fixed

I have implemented your example in latest CKEditor 3.6.1 and the problem seems to be fixed. Message was always displayed.

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy