hi everyone,
iam having a textbox in my application containg a calender iamge as shown below,which when clicked displays a calender,on clicking on the calender,the date is displayed in the textbox.

<asp:TextBox ID="txtfromdate"  runat="server" Width="100px"></asp:TextBox>   <A id="A5" href="javascript:show_calendar('aspnetForm.ctl00_ContentPlaceHolder1_txtfromdate','','','DD/MM/YYYY');" runat="server">
                 <img id="Img5" border="0" height="20" src="../images/cal.gif" runat="server" alt="Pick a date" width="24"/></A>

I want to validate this textbox on blur event but iam getting alert even when there is date text present in the textbox.The calender is working on a internal javascript.
Can any one suggest how to not get alert in "on blur" event.It is working for validation on submit button click.

Recommended Answers

All 4 Replies

post your validation function also...

function v_dob(nm)
     {
       var mn=document.getElementById(nm); 
      var valfal="false";
       var val=mn.value;
     
       for (var i=0; i<val.length; i++)
        {
		if (val.charAt(i) != " ")
		 {
			valfal="true";
		 }
	   }
    
       if(valfal!="true")
               { 
                                 return false;
               }
        else
               {
                  
                   return true;
                }
    }

Iam attaching datetimepicker along with this message

i dont know about asp...
but i think do validation to the text box in normal way..
i have implemented the same application in PHP and the text box with calender...i have used normal validation code for that...
check your code again..

hi,
Thanks for the reply.I have already mentioned in my previous post that validation is working fine in on whole form submission,but not for onblur event,the reason i guess may be due to since javascript is acting internally on the textbox,it is not working using onchange or onblur events.Hope u got my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.