Re: Addformrule
| From: | Mark Steudel | Date: | Wed, 26 May 2010 20:59:25 +0000 |
| Subject: | Re: Addformrule | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-30578@lists.php.net to get a copy of this message | ||
I assuming that $this->addNumericElement() is a custom method, can you
show us that? If you comment out $this->form->addFormRule does the
error go away?
On Wed, May 26, 2010 at 4:46 PM, zia mohaddes <zia.simab@gmail.com> wrote:
> Hello,
>
> I have previously posted a question on how to create a customize rule. And I
> have followed/created a customized rule as described in a response email as
> follows:
> $this->addNumericElement("q3_1_weight_1",$this->indent.
> "Weight in Kg");
> $this->addNumericElement("q3_1_weight_2",$this->indent. "Weight in
> Kg");
> $this->addNumericElement("q3_1_weight_3",$this->indent. "Weight in
> Kg");
> $this->form->addElement("static",null,null);
> $this->form->addFormRule(array(&$this,'checkQuestions'));
>
>
> function checkQuestions( $fields ) {
> $difference = abs(intval($fields['q3_1_weight_1']) -
> intval($fields['q3_1_weight_2']));
> if(( $difference <= 200 ) || strlen( $fields['q3_1_weight_3'] ) == 0 ) {
> $errors['q3_1_weight_3'] = 'Question 3.1 is required if first and second
> part are differed by more than 200 kg';
> }
> //return $errors;
> return count( $errors ) > 0 ? $errors : true;
> }
>
>
> however not only that the rule is not working but I am getting this error:
>
> "QuickForm Error: nonexistent html element"
>
> Not very sure why! Does anyone know why??
>
> Thank you kindly for your time and 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