Re: Addrule not working
| From: | Mark Steudel | Date: | Tue, 25 May 2010 14:37:32 +0000 |
| Subject: | Re: Addrule not working | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-30565@lists.php.net to get a copy of this message | ||
Where are you validating the form?
On Tue, May 25, 2010 at 10:23 AM, zia mohaddes <zia.simab@gmail.com> wrote:
> Hi mark,
> This is the entire code:
> function birth_details()
> {
> // add date of birth
> $this->form->addElement('date', 'dob1', 'Date of Birth',
> $dateOptions);
> $this->form->addElement('date', 'dob2', 'Confirm Date of
> Birth',
> $dateOptions);
> // date of birth rules
> $this->form->addRule('dob1', 'Date of Birth is required',
> 'required');
> $this->form->addRule(array('dob1', 'dob2'), 'Date of Birth
> fields must
> match', 'compare');
> //$form->addRule(array('cmpPasswd', 'cmpRepeat'), 'The passwords do
> not
> match', 'compare', null, 'client');
> // add gender
> $genderOptions = array('', 'Male' => 'Male',
> 'Female' => 'Female',
> 'expected'=>'Expected', 'no_birth'=>'No Birth');
> $this->form->addElement('select', 'gender', 'Gender',
> $genderOptions);
> // add to form
> // $this->tpl_data['elements_list'][]="gender";
> // gender rules
> $this->form->addRule('gender', 'Gender is required',
> 'required');
> $this->form->addFormRule(array(&$this, '_validate'));
> }
> birth_details() is in fact the constructor!
> Thank you kindly,
> for your help!
> regards,
> zia
> On Tue, May 25, 2010 at 9:28 AM, Mark Steudel <msteudel@gmail.com> wrote:
>>
>> Those rules look correct, let's see the rest of your form.
>>
>> MS
>>
>> On Tue, May 25, 2010 at 9:23 AM, zia mohaddes <zia.simab@gmail.com> wrote:
>> > Hello everyone,
>> >
>> > I am currently using addrule in my quickform as follows to do the
>> > following:
>> >
>> > $this->form->addRule('dob1', 'Date of Birth is required',
>> > 'required');
>> > $this->form->addRule(array('dob1', 'dob2'), 'Date of
>> > Birth fields must
>> > match', 'compare');
>> >
>> > but unfortunately this doesn't work at all? Am i missing something??
>> >
>> > Thank you kindly for your help in advance!
>> >
>> > regards,
>> >
>> > zia
>> >
>>
>>
>>
>> --
>>
>> -----------------------------------------
>> Mark Steudel
>> P: 206.375.7244
>> msteudel@gmail.com
>>
>> . : Work : .
>> http://www.mindfulinteractive.com
>>
>> . : Play : .
>> http://www.steudel.org/blog
>
>
--
-----------------------------------------
Mark Steudel
P: 206.375.7244
msteudel@gmail.com
. : Work : .
http://www.mindfulinteractive.com
. : Play : .
http://www.steudel.org/blog