Author: nnorman | Posted on: 4/7/2009 8:06:25 PM | Views : 463

Hi,

I have the following code lines in my asp.net project. txtDate is validated through the java script on button click event. This works on txtDate1 correctly. But is there a way that txtDate2 can also be validated using the same java script without duplicating it by somehow passing a string to the java script? I think there should be a way but I am not sure how to do it.. any thoughts?

function ValidateForm(){
var dt=document.getElementById("SchoolGraduateDate")
if (isDate(dt.value)==false){txtDate1
dt.focus()
return false
}
return true
}

<asp:TextBox ID="txtDate1" MaxLength="50" runat="server" Width="350px"></asp:TextBox>
<asp:TextBox ID="txtDate2" MaxLength="50" runat="server" Width="350px"></asp:TextBox>

<asp:Button ID="btnAddEducation" runat="server" ValidationGroup=" ...

Go to the complete details ...