PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #7470

$form->Validate() == true after succesful $form->SetElementError() call

Details

Submitted2006-04-24 11:02 UTC
Fromben dot lancaster at design-ontap dot co dot uk
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP Version4.4.1
OSFC4
Roadmaps(Not assigned)

Comments

[2006-04-24 11:02 UTC] ben dot lancaster at design-ontap dot co dot uk

Description:
------------
Validate() still returns true even after SetElementError() has been succesfully applied to an element.

Suggest adding an additional flag to the SetElementError() method to indicate whether the error set should force Validate() to fail.

Test script:
---------------
<?php
$form = new HTML_QuickForm;

$form->addElement('text','field','This field should fail:');

if($form->isSubmitted())
$form->setElementError('field','Sorry, that field is invalid');

if($form->Validate())
echo 'validated';
else
echo 'not validated';
?>

Expected result:
----------------
not validated

Actual result:
--------------
validated