Re: Quickform: Complex rule adding confusion
| From: | Bertrand Mansion | Date: | Thu, 17 Jul 2003 11:32:33 +0000 |
| Subject: | Re: Quickform: Complex rule adding confusion | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6642@lists.php.net to get a copy of this message | ||
<mikeatwork@ukonline.co.uk> wrote :
>
>> -----Original Message-----
>> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
>> Sent: 16 July 2003 22:33
>>
>>> $refRules['check'][] = array($language['L_RequireReferenceNumber'],
>>> 'required');
>>> $form->addGroupRule('referenceGroup', $refRules);
>>>
>>> However no rules seem to get applied to my input boxes. I can submit
>>> the form freely - no javascript appears in the HTML. I'm starting to
>>> think I may need to specify that the rules run on the client side -
>>> but how do I specify this using the above rule adding technique?
>>
>> Look there for more info on form validation for groups, it might be clearer:
>>
>>
>> http://www.appelsiini.net/~tuupola/php/peardoc2/package.html.html-quickform.
>> intro-validation.html
>>
>> You can add client validation by adding 'client' as a last parameter in your
> rule >definition arrays.
>
> Hi Bertrand,
>
> I altered my rule to have the 'client' on the end...
>
> $refRules['check'][] = array($language['L_RequireReferenceNumber'],
> 'required',
> null, 'client');
> $form->addGroupRule('referenceGroup', $refRules);
>
> Yet still get no joy from any javascript creation - as if the 'client'
> instruction isn't being picked up!
>
> Validation does work, but only on the server side - so a message gets embedded
> in the HTML upon page reload.
>
> The documentation at the URL you provided doesn't seem to mention setting the
> group rules on the client side, so i assumed they are no different to when you
> add a single rule for running on the client side.
Sorry Mike, this is not supported on client, it would be make the javascript
generation too complex. Maybe it will be supported in the future though...
You will have to use server-side validation only for now.
Bertrand Mansion
Mamasam