From: aspfun via DotNetMonster.com on 2 Mar 2010 08:53 How to call the function validate() on the form loading? There is a form in which another program will fill some text boxes automatically. I need this JS function to test the value of text boxes and give user a alert if any text box is empty. <script type="text/javascript"> function validate() { var t1 = document.getElementById('<%=txtOrderProduct.ClientID%>'); var t2 = document.getElementById('<%=txtOrderBy.ClientID%>'); if(t1.value == "" && t2.value == "") { alert("Empty'); } } </script> -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201003/1
From: Alexey Smirnov on 2 Mar 2010 11:40 On Mar 2, 2:53 pm, "aspfun via DotNetMonster.com" <u53138(a)uwe> wrote: > How to call the function validate() on the form loading? > There is a form in which another program will fill some text boxes > automatically. > I need this JS function to test the value of text boxes and give user a alert > if any text box is empty. > > <script type="text/javascript"> > function validate() > { > var t1 = document.getElementById('<%=txtOrderProduct.ClientID%>'); > var t2 = document.getElementById('<%=txtOrderBy.ClientID%>'); > > if(t1.value == "" && t2.value == "") > { > alert("Empty'); > }} > > </script> > > -- > Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201003/1 Use <body onload="validate();">. Hope this helps
From: aspfun via DotNetMonster.com on 2 Mar 2010 12:02 Alexey Smirnov wrote: >> How to call the function validate() on the form loading? >> There is a form in which another program will fill some text boxes >[quoted text clipped - 17 lines] >> -- >> Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201003/1 > >Use <body onload="validate();">. > >Hope this helps I tested it in a simple page. It is working. But how to add it into a content page with master page? There is no body tag. -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201003/1
|
Pages: 1 Prev: Question regarding detecting 404 Not Found Next: Keeping track of users LogIn |