You should open a ticket for this request. After opening a ticket, it would
be super awesome if you sent a pull request for us with this change in it.

On Wed, Sep 29, 2010 at 5:53 AM, Robert <[email protected]> wrote:

> May I suggest one more change?
>
> In  Form.Validator.Inline function insertAdvice
>
> change this:
> if (field.type.toLowerCase() == 'radio')
> field.getParent().adopt(advice);
>
> for this:
> if (field.type && field.type.toLowerCase() === 'radio')
> field.getParent().adopt(advice);
>
>    insertAdvice: function(advice, field) {
>        //Check for error position prop
>        var props = field.get('validatorProps');
>        //Build advice
>        if (!props.msgPos || !document.id(props.msgPos)) {
>            if (field.type && field.type.toLowerCase() == 'radio')
> field.getParent().adopt(advice);
>            else advice.inject(document.id(field), 'after');
>        } else {
>            document.id(props.msgPos).grab(advice);
>        }
>    },
>
>
> this would allow me to set validators to elements like "div", for
> example:
>
> Form.Validator.add('rs-div-required', {
>    errorMsg: function() {
>        return Form.Validator.getMsg('required');
>    },
>    test: function(element) {
>       return !((element.get('text') == null) ||
> (element.get('text').length == 0));
>    }
>
> });
>
> I am using them for fields with complex data (images, date-ranges,
> etc).
>

Reply via email to