Hi back everyone,
Like you said Aaron i thought i had a solution that worked, but the "value"
object i'm using seems to be only available under Chrome
When i test it on firefox the validator fails and the form gets POSTed
i think i'll try to use the validator you showed me in the doc, but in the
meantime
any idea about why this behaviour on Firefox ... ?
Thanks again.

2011/8/14 Aaron Newton <[email protected]>

> Well, the validator I sent you looks for a shared DOM parent, so your html
> below wouldn't work. But that's ok; one of the nice things about the
> validator code is how easy it is to write your own. Seems like you have a
> solution that works.
>
>
> On Sun, Aug 14, 2011 at 12:55 AM, Olivier Girardot <[email protected]>wrote:
>
>> Thanks Aaron, that's what i did, :
>>
>> Form.Validator.add('validate-at-least-one-required', {
>>     errorMsg: 'At least one field is required',
>>     test: function(element, value){
>>         if (element.value.length == 0 &&
>> value['validate-at-least-one-required'].value.length == 0) return false;
>>         else return true;
>>     }
>> });
>>
>> using it like that :
>> <li><textarea id="positifComment" name="positif_comment"
>> class="validate-at-least-one-required:negatifComment" rows="5"
>> cols="30"></textarea></li>
>> <li><textarea id="negatifComment" name="negatif_comment"
>> class="validate-at-least-one-required:positifComment"rows="5"
>> cols="30"></textarea></li>
>>
>> But what you showed seems to be exactly what i needed :)
>> Thanks,
>>
>> Olivier.
>>
>> 2011/8/14 Aaron Newton <[email protected]>
>>
>>> There is already a validator for this. Note that there seems to be
>>> something wrong with the docs for the form validator (the parser is breaking
>>> on something), so I can't easily link to it, but you can read about it on
>>> github's parsed version:
>>>
>>>
>>> https://github.com/mootools/mootools-more/blob/master/Docs/Forms/Form.Validator.md
>>>
>>> Search for validate-one-required
>>>
>>> If that doesn't suit your needs, write your own custom validator; they're
>>> pretty easy to write.
>>>
>>>
>>> On Sat, Aug 13, 2011 at 4:33 AM, Olivier Girardot <[email protected]>wrote:
>>>
>>>> Hi everyone,
>>>> i'm using the Form.Validator.Inline greatly for my forms, but now i need
>>>> to specify a validation condition for two fields like "at least one is
>>>> required",
>>>> i didn't find anything in the documentation, as it seems that validation
>>>> using class attributes is only on a per-field basis.
>>>> Is there any way to do it using Form.Validator.Inline ?
>>>> Thanks everyone,
>>>>
>>>> Regards.
>>>> Olivier.
>>>>
>>>
>>>
>>
>

Reply via email to