Click here to Skip to main content
15,908,775 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
<script language="javascript" type="text/javascript">
      function JobDetailsValidation()
      {
      debugger;
      var Position=document.getElementById("txtPosition").value;
      var KeySkills=document.getElementById("txtKeySkills").value;
      var JobDescription=document.getElementById("txtJobDiscription").value;
      var JobLocation=document.getElementById("txtJobLocation").value;
      if(Position==null||Position==""||KeySkills==null||KeySkills==""||JobDescription==null||JobDescription==""||JobDescription==null||JobDescription==""||JobLocation==null||JobLocation=="")
     {
       alert("Job Details name must be filled out");
       return false;
     }
     else 
          {
            ExperienceValidation()
          }
      }
      function ExperienceValidation()
      {
      var Experience=document.getElementById("DropDownList1").value;
      var Experience1=document.getElementById("DropDownList2").value;
      var CTC=document.getElementById("DropDownList3").value;
      var Level=document.getElementById("DropDownList4").value;
      var Gender=document.getElementById("DropDownList5").value;
      if(Experience==null||Experience==""||Experience1==null||Experience1==""||CTC==null||CTC==""||Level==null||Level==""||Gender==null||Gender=="")
          {
             alert("Please Select All Details Of Experience Section");
             return false;
          } 
     return false;
      }
      </script>




I uses this code in javascript,but my problem is when the function ExperienceValidation() run and when it returns false the request is still going on the server side.Please help me and thanks in advance
Posted
Updated 17-Nov-11 0:10am
v2
Comments
Smithers-Jones 17-Nov-11 6:11am    
Added code-block.
Richard MacCutchan 17-Nov-11 6:20am    
Does it ever return true, and if so what happens at the point where the function is called?
Pandya Anil 17-Nov-11 7:05am    
put your markup, how did you invoked it ?

when you calling javascript from Button give "return" , check below

ASP.NET
<asp:button id="btnOne" runat="server" text="check" onclientclick="return JobDetailsValidation()" xmlns:asp="#unknown"></asp:button>
 
Share this answer
 
You can try with OnClientClick

for more info see http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick.aspx[^]


- Nilesh
 
Share this answer
 
v2
Comments
Vishwajeet Singh Chouhan 17-Nov-11 23:16pm    
i got the mistake,whenever my ExperienceValidation() was called it returns false but i am not catching the return value at the point from where the function is called
i got the mistake,whenever my ExperienceValidation() was called it returns false but i am not catching the return value at the point from where the function is called
 
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