js/ka-ui.js
/**
     * Refreshes the contents of the message box with the current
     * set of alert messages. Handles de-duplication of errors.
     */
Refreshes the contents of the message box with the current
set of alert messages. Handles de-duplication of errors.
Refreshes the contents of the message box with the current set of alert messages . Handles de - duplication of errors .
function updateMessagesBox() {
        messagesBox.val(alerts.map(function (alert) { 
            var msg;
            switch (alert.type) {
            case validator.alertTypes.REQUIRED:
                msg = alert.nodeType + ' Is Needed';
                break;
            case validator.alertTypes.DISALLOWED:
                msg = alert.nodeType + ' Is Not Allowed';
                break;
            case validator.alertTypes.STRUCTURAL:
                msg = alert.message;
                break;
            case validator.alertTypes.PARSER_ERROR:
                msg = alert.message;
                break;
            }
            return msg;
        }).sort().filter(function (value, index, arr) { 
            if (index < 1) {
                return true;
            }
            return value !== arr[index - 1];
        }).reduce(function (prev, cur) { 
            if (cur) {
                return prev + cur + '\n';
            }
            return prev;
        }, ''));
    }
function updateMessagesBox ( ) { messagesBox . val ( alerts . map ( function ( alert ) { var msg ; switch ( alert . type ) { case validator . alertTypes . REQUIRED : msg = alert . nodeType + ' Is Needed' ; break ; case validator . alertTypes . DISALLOWED : msg = alert . nodeType + ' Is Not Allowed' ; break ; case validator . alertTypes . STRUCTURAL : msg = alert . message ; break ; case validator . alertTypes . PARSER_ERROR : msg = alert . message ; break ; } return msg ; } ) . sort ( ) . filter ( function ( value , index , arr ) { if ( index < 1 ) { return true ; } return value !== arr [ index - 1 ] ; } ) . reduce ( function ( prev , cur ) { if ( cur ) { return prev + cur + '\n' ; } return prev ; } , '' ) ) ; }
Refreshes the contents of the message box with the current
 set of alert messages.
Refreshes the contents of the message box with the current set of alert messages .
//process alerts into message strings //remove duplicates //reduce array of messages to single string