Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
var fname = document.getElementById('<%=txtFName.ClientID%>').value;
           var dob = document.getElementById('<%=txtDob.ClientID%>').value;
           var mail = document.getElementById('<%=txtMail.ClientID%>').value;
           var web = document.getElementById('<%=txtWebsite.ClientID%>').value;
           var phone = document.getElementById('<%=txtPhone.ClientID%>').value;
           var salary = document.getElementById('<%=txtSalary.ClientID%>').value;
           var department = document.getElementById('<%=drpDepart.ClientID%>').value
           var branch = document.getElementById('<%=drbBranch.ClientID%>').value
           var error = "";
           if (fname == "" && dob == "" && mail == "" && web == "" && phone == "") {

               error = "Please Enter Following Details:";

               if (fname == "") {
                   error += "\n Enter Employee FirstName.";
               }
               if (dob == "") {
                   error += "\n Enter Employee Date Of Birth.";
               }
               if (mail == "") {
                   error += "\n Enter Employee Email.";
               }
               if (web == "") {
                   error += "\n Enter Employee Website.";
               }
               if (salary == "") {
                   error += "\n Enter Employee Salary.";
               }
               if (department == "--Select--") {
                   error += "\n Select Employee Department.";
               }
               if (branch == "--Select--") {
                   error += "\n Select Employee Branch.";
               }
               alert(error);
           }
           else {
               return true;

           }
i am enter FNAME text box but didn't show error what can i do any help me!!!!!
Posted
Comments
Timberbird 30-Aug-12 2:58am    
Calm down. Bugs are way too common to get excited every time you get one. First, what is your problem? "I am enter FNAME text box but didn't show error" looks like valid logic. If you didn't enter fname, that's another thing. First, are you sure you need "&&", not "||"? Second, you could consider adding "return false;" explicitly.
Providing more information would help us to understand the situation better

1 solution

hey change you condition like below code:
JavaScript
if (fname == "" || dob == "" || mail == "" || web == "" || phone == "") {
 
Share this answer
 

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