From: aspfun via DotNetMonster.com on
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
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
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