QF - addGroupRule() on custom function

From: Date: Tue, 14 Oct 2003 11:18:51 +0000
Subject: QF - addGroupRule() on custom function
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8417@lists.php.net to get a copy of this message
Hello, I have a group of elements [scengroup][1] ... [scengroup][n] I wish to validate each element individually against a custom function "ok_values". The doc says: "To validate grouped elements as separate entities, use addGroupRule()." I have tried: $form->addGroupRule( 'scengroup', 'You have selected an invalid scenario!', 'ok_values' ) ; But I saw that the validator passes ($submitValue) to the function the whole 'scengroup' array in a singe pass; Though I expected that it would pass each array element in a row. This is the behaviour I expected from addRule. Indeed, when trying the same with addRuleinstead of addGroupRule, I found exactly similar form properties [_rules] and [_errors]. I could easily rewrite the custom function to deal with the array; but then I lost the benefit of having a separate error message attached to each invalid field. Did I miss something? Thanks Ignatius Reilly

« previous php.pear.general (#8417) next »