function getValidationScript($format = null) {
        global $CFG;
        if (!empty($CFG->strictformsrequired)) {
            if (!empty($format) && $format == FORMAT_HTML) {
                return array('', "{jsVar}.replace(/(<(?!img|hr|canvas)[^>]*>)|&nbsp;|\s+/ig, '') == ''");
            } else {
                return array('', "{jsVar}.replace(/^\s+$/g, '') == ''");
            }
        } else {
            return array('', "{jsVar} == ''");
        }
    }
function getValidationScript($format = null) {
        global $CFG;
        if (!empty($CFG->strictformsrequired)) {
            if (!empty($format) && $format == FORMAT_HTML) {
                return array('', "{jsVar}.replace(/(<(?!img|hr|canvas)[^>]*>)|&nbsp;|\s+/ig, '') == ''");
            } else {
                return array('', "{jsVar}.replace(/^\s+$/g, '') == ''");
            }
        } else {
            return array('', "{jsVar} == ''");
        }
    }
function getValidationScript ( $ format = null ) { global $ CFG ; if ( ! empty ( $ CFG -> strictformsrequired ) ) { if ( ! empty ( $ format ) && $ format == FORMAT_HTML ) { return array ( '' , "{jsVar}.replace(/(<(?!img|hr|canvas)[^>]*>)|&nbsp;|\s+/ig, '') == ''" ) ; } else { return array ( '' , "{jsVar}.replace(/^\s+$/g, '') == ''" ) ; } } else { return array ( '' , "{jsVar} == ''" ) ; } }
This function returns Javascript code used to build client-side validation.
It checks if an element is not empty.

@param int $format format of data which needs to be validated.
@return array
This function returns Javascript code used to build client - side validation . It checks if an element is not empty .