rice-framework/krad-web/src/main/webapp/krad/scripts/krad.validate.js
/**
 * Checks a particular field to see if it is now required, the field is considered required if the booleanFunction
 * evaluates to true.
 *
 * @param requiredName
 * @param booleanFunction
 * @param indicator
 */
Checks a particular field to see if it is now required, the field is considered required if the booleanFunction
evaluates to true.


Checks a particular field to see if it is now required the field is considered required if the booleanFunction evaluates to true .
function checkForRequiredness(requiredName, booleanFunction, indicator) {
    var requiredControl = jQuery("[name='" + escapeName(requiredName) + "']");
    var id = requiredControl.attr("id");
    var label;
    if (id.indexOf('_comp') > 0) {
        id = getAttributeId(id);
        id = id.substring(0, id.indexOf('_comp'));
        label = jQuery("label[data-label_for*='" + id + "']");
    }
    else {
        label = jQuery("label[data-label_for='" + id + "']");
    }
    if (indicator != null && indicator.length) {
        if (booleanFunction()) {
            if (label.find("." + kradVariables.REQUIRED_MESSAGE_CLASS).length == 0) {
                label.append("<span class='" + kradVariables.REQUIRED_MESSAGE_CLASS + "'>" + indicator + "</span>");
            }
            requiredControl.attr("aria-required", "true");
            requiredControl.addClass("required");
        }
        else {
            label.find("." + kradVariables.REQUIRED_MESSAGE_CLASS).remove();
            requiredControl.attr("aria-required", "false");
            requiredControl.removeClass("required");
        }
    }
}
function checkForRequiredness ( requiredName , booleanFunction , indicator ) { var requiredControl = jQuery ( "[name='" + escapeName ( requiredName ) + "']" ) ; var id = requiredControl . attr ( "id" ) ; var label ; if ( id . indexOf ( '_comp' ) > 0 ) { id = getAttributeId ( id ) ; id = id . substring ( 0 , id . indexOf ( '_comp' ) ) ; label = jQuery ( "label[data-label_for*='" + id + "']" ) ; } else { label = jQuery ( "label[data-label_for='" + id + "']" ) ; } if ( indicator != null && indicator . length ) { if ( booleanFunction ( ) ) { if ( label . find ( "." + kradVariables . REQUIRED_MESSAGE_CLASS ) . length == 0 ) { label . append ( "<span class='" + kradVariables . REQUIRED_MESSAGE_CLASS + "'>" + indicator + "</span>" ) ; } requiredControl . attr ( "aria-required" , "true" ) ; requiredControl . addClass ( "required" ) ; } else { label . find ( "." + kradVariables . REQUIRED_MESSAGE_CLASS ) . remove ( ) ; requiredControl . attr ( "aria-required" , "false" ) ; requiredControl . removeClass ( "required" ) ; } } }
Checks a particular field to see if it is now required, the field is considered required if the booleanFunction
 evaluates to true.
Checks a particular field to see if it is now required the field is considered required if the booleanFunction evaluates to true .
// this check if for use in collections with 'old' and 'new' listings
 // in these cases the 'new' id will be like xxx_comp1
 // however the label is setup for the 'old' control and will be like xxx_comp0
 // therefore strip off the '_comp' portion and search for a label that 'contains' the new id
 // add required span, aria, and css class
 // remove required span, set aria, and remove css class
