Re: [qf] addRule on static element?

From: Date: Wed, 11 Jan 2006 13:12:11 +0000
Subject: Re: [qf] addRule on static element?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22501@lists.php.net to get a copy of this message
This is not a bug, but the normal behaviour. As you have probably noticed, "static" elements are used only to show static messages; they do not create form control elements. Instead (or in addition) you need to create a hidden element "username" with the actual default value. This will create the form element that you need for the form rule. HTH Skye Poier thus spake on 2006-01-11 08:07:
Hi, it's me again. I have a QuickForm page with... $form->addElement('static', 'username', 'Member ID:'); $form->addElement('password', 'password', 'Enter Password:'); $form->setDefaults(array('username' => $user['username'])); function cm_login_check($elements) {
    $password = $elements[0];
    $username = $elements[1];
    ... check ...
} ... register rule $form->addRule(array('password', 'username'), 'Incorrect password.', 'login_check'); Well, the cm_login_check isn't getting anything for $elements[1], $username is blank... if I change the static element to a hidden element, it works fine. So that makes me think static elements can't be used in rules. Bug or feature or user error? Thanks, Skye


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