Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
My Javascript Code:

JavaScript
function mainvalidation() {
            alert("1");
            var select_time = document.getElementById('<%=SelectTimeZone.ClientID %>');
            var select_grade = document.getElementById('<%=DropDownListLevel.ClientID %>').nodeValue.toString();
            var select_area = document.getElementById('<%=DropDownListArea.ClientID %>').nodeValue.toString();
            var select_subject = document.getElementById('<%=DropDownListSubject.ClientID %>').nodeValue.toString();
            var uemail = document.getElementById('<%=TxtEMailID.ClientID %>').nodeValue.toString();
            var uname = document.getElementById('<%=TxtName.ClientID %>').nodeValue.toString();

            if (select_time == "" || select_time == "Select Time Zone") {
                alert("Select Time Zone");
                return false;
            }
            
            if (select_grade == "" || select_grade == "Select Grade") {
                alert("Select Grade");
                return false;
            }
            if (select_area == "" || select_area == "Select Area") {
                alert("Select Area");
                return false;
            }
            if (select_subject == "" || select_subject == "Select Subject") {
                alert("Select Subject");
                return false;
            }
            if (uname == "" || uname == "Enter Your Name ...") {
                alert("Enter Your Name");
                return false;
            }

            if (uemail == "" || uemail == "Enter Your e-mail ...") {
                alert("Enter Email ID");
                return false;
            }
            var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/
            var EmailmatchArray = uemail.match(emailPat);
            if (EmailmatchArray == null) {
                alert("Your email address seems incorrect. Please try again.");
                return false;
            }
           }


In the line
JavaScript
var select_time = document.getElementById('<%=SelectTimeZone.ClientID %>');


after ClientID value function is not coming for me.
Posted

try this way..........


("#<%=txtdropoffdate.ClientID%>")
 
Share this answer
 
Comments
riodejenris14 27-Nov-13 6:36am    
thnx priya for you code help!!! :)
Try this

<br />
var select_time = document.getElementById('<%=SelectTimeZone.ClientID %>');<br />
var txt=select_time.options[select_time.selectedIndex].text;<br />
var val=select_time.options[select_time.selectedIndex].value;<br />
<br />
 
Share this answer
 
What is SelectTimeZone?
If it is some cotrol please take value using .value like

JavaScript
var select_time = document.getElementById('<%=SelectTimeZone.ClientID %>').values;
 
Share this answer
 
Comments
riodejenris14 26-Nov-13 7:02am    
thanxs abhishek for sparing time for my issue. select time zone is a dropdown list .value function is not showing that is the problem. I searched in all forums they used value attribute but it is not getting loaded and not visible in attributes list.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900