Java Script Validation

  • Thread starter Thread starter hoz
  • Start date Start date
H

hoz

Hi ,
I am developing an web application . I have a form for user login ,contains
two textboxs . How can i check them if these are empty using client side
validation ?
But i want it like below
<script lang="..... >
function Validate()
{ if ( this.forms.userTxt=="")
return false ;
....
}
</script>

the button is server side , how can i add , when clicked first goto Validate
and then execute button_click() ?
 
Button.Attributes.Add ("onClick", "return Validate();")

Your Validate() function should return true if postback should occur, false
to stay.

Another option is to use the RequiredFieldValidator control (one for each
text box).

Hi ,
I am developing an web application . I have a form for user login ,contains
two textboxs . How can i check them if these are empty using client side
validation ?
But i want it like below
<script lang="..... >
function Validate()
{ if ( this.forms.userTxt=="")
return false ;
....
}
</script>

the button is server side , how can i add , when clicked first goto Validate
and then execute button_click() ?
 
Hello hoz,

Look at the asp:RequiredFieldValidator control. This handles everything for
you. You dont need to write any javascript.
 
Back
Top