This project is archived and is in readonly mode.

#394 ✓resolved

Form.Validator.Inline checks value of field.type only if there is field.type

Reported by Robert | September 29th, 2010 @ 02:23 PM | in

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);

this would allow to set validators to elements which do not have type property (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).

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket