Forum Moderators: coopster

Message Too Old, No Replies

PEAR::HTML_QuickFrom - How do I do Group validation?

HTML_QucikForm validation problem

         

The_Warden

4:38 pm on May 12, 2006 (gmt 0)

10+ Year Member



Using HTML_QuickForm how do I apply a group validation on two elements when there is no other validation errors? I'm trying to display one error message when username and/or password have a mismatch (invalid). I still want it to highlight each element within the group that has an error. Right now I'm trying to achieve this using AddFormRule(). AddGroupRule() you would think would be a good option. However it still doesn't provide me with what I require. See how I understand it and how I have it now all rules are validated as a whole each time the form is submitted. The username and password validate against the database shouldn't occur until all the other validations pass. If this is not done you get error messages that the username is invalid and password is invalid. Which is true but not entirely as the other validation rules have to be checked first and if they pass then check the username and password against the database together and is validated using AddFormRule(), custom validation via a function. See I have these rules presently.

Here's what I have for rules...

$obForm->addRule('szUsername', 'Username required.', 'required');
$obForm->addRule('szUsername', 'Username must be 2 to 20 characters in length.', 'rangelength', array(2, 20));
$obForm->addRule('szPassword', 'Password required.', 'required');
$obForm->addRule('szPassword', 'Password must be 8 to 20 characters in length.', 'rangelength', array(8, 20));

Then I have the custom validation against the database to check username and password together.

$obForm->AddFormRule("fnValidateCredentials");

Any help would be much appreciated. If you require more information please let me know.

jatar_k

5:20 pm on May 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



anyone have any ideas, I have never used that package