Opened 14 years ago

Closed 13 years ago

#5996 closed Bug (fixed)

CKEDITOR.dialog.validate.functions is buggy.

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


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 (4)

comment:1 Changed 14 years ago by anrikun

Version: 3.3.1

comment:2 Changed 14 years ago by Sa'ar Zac Elias

Status: newpending

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

comment:3 Changed 14 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 13 years ago by Jakub Ś

Resolution: fixed
Status: pendingclosed

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 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy