//$Revision: 1.11 $
<!-- baserule_NotNull -->
function bmiasia_ebos_constraint_baserule_NotNull()
{
    if( ! this.ui.validationList)
    {
        this.ui.validationList = new Array();
    }

    var isExisted = false;
    for(var i = 0; i < this.ui.validationList.length; i ++)
    {
        var action = this.ui.validationList[i][0];
        if (this.ui.validationList[i][1] == bmiasia_ebos_constraint_baserule_NotNull_internal
                && action.ui == this.ui && action.message == this.message)
        {
            isExisted = true;
        }
    }
    // Not submit when not existed
    if( ! isExisted)
    {
        var action = new Object();
        action.message = this.message;
        action.ui = this.ui;
        this.ui.validationList.push(new Array(action, bmiasia_ebos_constraint_baserule_NotNull_internal));
    }

    registerConstraint(this.ui);
    return bmiasia_ebos_constraint_baserule_NotNull_internal.call(this);
}

function bmiasia_ebos_constraint_baserule_NotNull_internal()
{
    if(this.ui.type == "text" || this.ui.type == "password" || this.ui.type == "hidden")
    {

        var value = this.ui.value;
        if(document.activeElement!=null && document.activeElement.name != this.ui.name)
        {
            this.ui.style.backgroundColor = "";
        }
        if(value.length > 0)
        {
            this.ui.style.backgroundColor = "";
            return true;
        }
        else
        {
            try
            {
                this.ui.style.backgroundColor = "#FFCC00";
            }
            catch(e)
            {
            }
            constraint(this.ui.name, this.message);
            return false;
        }
    }
    else if(this.ui.type == "checkbox")
    {
        if(this.ui.checked == true)
        {
            this.ui.className = "";
            return true;
        }
        else
        {
            try
            {
                this.ui.className = "checkbox_constraint";
            }
            catch(e)
            {
            }
            constraint(this.ui.name, this.message);
            return false;
        }
    }
    else if(this.ui.type == "select-one")
    {
        if(this.ui.value == "_NOT_SPECIFIED" || this.ui.value == "")
        {
            try
            {
                this.ui.className = "select_constraint";
            }
            catch(e)
            {
            }
            constraint(this.ui.name, this.message);
            return false;
        }
        else
        {
            this.ui.className = "";
            return true;
        }
    }
    else if(this.ui.type == "select-multiple")
    {
        if(this.ui.length > 0)
        {
            this.ui.className = "";
            return true;
        }
        else
        {
            try
            {
                this.ui.className = "select_constraint";
            }
            catch(e)
            {
            }
            constraint(this.ui.name, this.message);
            return false;
        }
    }
    else if(this.ui[0] != undefined)
    {
        if(this.ui[0].type == "radio" || this.ui[0].type == "checkbox")
        {
            for(var i = 0; i < this.ui.length; i ++ )
            {
                if(this.ui[i].checked == true)
                {
                    this.ui.className = "";
                    return true;
                }
            }
            try
            {
                this.ui.className = "checkbox_constraint";
            }
            catch(e)
            {
            }
            constraint(this.ui.name, this.message);
            return false;
        }
    }
    return true;
}
