Edit report at https://pear.php.net/bugs/bug.php?id=19620&edit=1
ID: 19620
Updated by: loki_angel@mail.ru
Reported By: loki_angel at mail dot ru
Summary: How to validate hidden fields?
Status: Bogus
Type: Bug
Package: HTML_QuickForm2
Package Version: 2.0.0
PHP Version: Irrelevant
Roadmap Versions:
New Comment:
It's can be own handler (in callback function for example) or it's can
be common property of form object ($form->errors). In the end it may
not be errors at all, but the form does not pass validation.
Previous Comments:
------------------------------------------------------------------------
[2012-09-27 21:31:39] avb
-Status: Open
+Status: Bogus
This change is intentional and mentioned in release notes.
There are two problems with setting validation errors on hidden
elements:
1) Where do you expect these to be displayed?
2) How do you expect users to fix them?
------------------------------------------------------------------------
[2012-09-27 11:31:22] loki
Description:
------------
In last version I can't assign rule to hidden fields. It's becomes an
error "Hidden elements cannot have validation errors"
But without error it's not validate at all and form becomes valid.
Test script:
---------------
$token=$form->addElement('hidden', 'token', array('value'=>$token));
$token->addRule('callback', 'token error',
array('callback'=>'checkToken', 'arguments'=>array(false)));
------------------------------------------------------------------------