Validate Fields that are required and put border in Red color

0

Good afternoon friends, I hope you can help me. I am validating some fields with asp.net using requiredFieldValidator and JavaScrip. my code works but I have problems when I have an invisible fields and when this is enabled since depending on the business's business rule some employees do not require that field and others do. I leave my JavaScrip code I hope you can help me.

function ValidatorUpdateDisplay(val) {
            if (typeof (val.display) == "string") {
                if (val.display == "None") {
                    return;
                }
                if (val.display == "Dynamic") {
                    val.style.display = val.isvalid ? "none" : "inline";
                    return;
                }

            }
            val.style.visibility = val.isvalid ? "hidden" : "Visible";
            if (val.isvalid) {
                document.getElementById(val.controltovalidate).style.border = '1px ridge #838484';
            }
            else {
                document.getElementById(val.controltovalidate).style.border = '2px solid red';
            }
        }
'
    
asked by Carlos Emmanuel Arcos Novelo 11.09.2018 в 00:47
source

0 answers