summaryrefslogtreecommitdiff
path: root/js/form/ValidationMultiSelect.js
blob: 4e7263c61fddc5046921952d72e1d5b22143e1c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* global define */

// only supports required for the time being
// TODO: maybe show dojo native error message? i dunno
define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/MultiSelect", ],
    function(declare, lang, MultiSelect) {

        return declare('fox.form.ValidationMultiSelect', [MultiSelect], {
            constructor: function(params){
                this.constraints = {};
                this.baseClass += ' dijitValidationMultiSelect';
            },
            validate: function(/*Boolean*/ isFocused){
                if (this.required && this.attr('value').length == 0)
                    return false;

                return true;
            },
        })
    });