validation on a usercontrol on aspx page using javascript
<p>I have a user control that contains 3 dropdown for(date,month, year).I have called this user control on aspx page.</p>

<p>
Please select Date From.</p>

<p>On my aspx page all fields are validated with javascript validation.
when I select date from this user control (not month &amp; year) ,and click on submit button, it shows the error message.
but my problem is that if i select year (not date,month) then in this case neither it  fire the error message nor it saves the data.
I want that it fired the message everytime when atleast one field(day,month,year) is not selected.I want to handle this problem on clentside. Please give me your suggetion.</p>

<pre><code>function InputValidation(vg) {
    var isValid = true;
    try {
        var j = 0;
        var inputCtrlArr = new Array();
        var key = 'block';
        var inputIntputArr = document.getElementsByTagName('input');
        var inputDdlArr = document.getElementsByTagName('select');
        var inputTextareaArr = document.getElementsByTagName('textarea');
        var c = 0;
        for (var i = 0; inputIntputArr.length &gt; i; i++) inputCtrlArr[c++] = inputIntputArr[i];
        for (var i = 0; inputDdlArr.length &gt; i; i++) inputCtrlArr[c++] = inputDdlArr[i];
        for (var i = 0; inputTextareaArr.length &gt; i; i++) inputCtrlArr[c++] = inputTextareaArr[i];
        for (var i = 0; inputCtrlArr.length &gt; i; i++) {
            if (inputCtrlArr[i].getAttribute('required') == 'true' &amp;&amp; inputCtrlArr[i].getAttribute('vg') == vg) {
                if (inputCtrlArr[i].value.trim() == '') {
                    //errinputReqCtrlArr[j++] = inputCtrlArr[i];
                    key = 'block';

                    isValid = false;
                }
                else {
                    key = 'none';
                }
                if (inputCtrlArr[i].type == "checkbox") {
                    if (inputCtrlArr[i].checked == false) {
                        //errinputReqCtrlArr[j++] = inputCtrlArr[i];
                        key = 'block';

                        isValid = false;
                    }
                    else {
                        key = 'none';
                    }
                }
                var errorDivId = inputCtrlArr[i].getAttribute('ErrorDivId');
                var objErrorDivId = document.getElementById(errorDivId);
                if (objErrorDivId != null) objErrorDivId.style.display = key;
            }
        }
 }
    catch (ex) { }

}



function InputCntrlValidate(obj) {
    try {
        if (obj.getAttribute('required') == 'true') {
            if (obj.value == '') {
                key = 'block';
            }
            else {
                key = 'none';
            }
            var errorDivId = obj.getAttribute('ErrorDivId');
            var objErrorDivId = document.getElementById(errorDivId);
            if (objErrorDivId != null) objErrorDivId.style.display = key;
        }
    } catch (ex) { }
}




function sanitizeInput(obj) {

    if (obj.getAttribute('msg') == obj.value) {
        alert("same value");
    }

}
</code></pre>
