One of the quirks of ASP.NET validation controls. If there is nothing
entered, the validation won't fire.  You need to use two validators in
this case, your custom validator and a RequiredFieldValidator.

On 7/27/05, esimplest <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> The below code does not validate, if you just hit submit (i.e leaving
> the text box with just blank) Any idea?
> 
> Thanks
> ****************************************************************
> 
> <SCRIPT LANGUAGE="JavaScript">
> function validateLength(oSrc, args){
>    args.IsValid = (args.Value.length >= 8);
> }
> </SCRIPT>
> 
> <asp:Textbox id="text1" runat="server" text="">
> </asp:Textbox>
> 
> <asp:CustomValidator id="CustomValidator1" runat=server
>       ControlToValidate = "text1"
>       ErrorMessage = "You must enter at least 8 characters!"
>    ClientValidationFunction="validateLength" >
> </asp:CustomValidator>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 


-- 
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to