Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 12th, 2004, 12:53 AM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom Validator for Two text box.

hello..

I have 2 text box and I've to show an error message if both are blank. Atleast one of the two should be filled out by the user.
I tried customvalidator but it works only if the text box is not blank. Someone plz help me...:(

Thanks
Vicky
 
Old October 13th, 2004, 07:21 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

what code have you written for validation in your customvalidator??

Regards
Ganesh
 
Old October 15th, 2004, 06:41 AM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm bit confused how to use customvalidator for two text box.... Following is the code I'd tried....

<asp:customvalidator id="emailvalidator" Runat="server" ControlToValidate="TxtMailId" Display="Dynamic"
ClientValidationFunction="CheckTextBox" EnableClientScript="True" ErrorMessage="Please fill Name or Email Id to Search." CssClass="error">
</asp:customvalidator>

function CheckTextBox(objsrc, objArgs)
    {

        var Valid1=false;
        var EmailValue = document.Template.TxtEmail.value
        var NameValue = document.Template.TxtEmail.value
        if(EmailValue=="" && NameValue=="")
        {
            Valid1 = false;
        }
        else
        {
            Valid1 = true;
        }
        objArgs.IsValid=Valid1;
        return;
    }

Quote:
quote:Originally posted by r_ganesh76
 what code have you written for validation in your customvalidator??

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
DDL Custom Validator AspNetGuy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 6th, 2008 05:17 PM
Custom Validator against a database Steve Spicer ASP.NET 2.0 Professional 16 January 12th, 2008 06:25 AM
custom validator question kscdave Classic ASP Professional 3 April 24th, 2005 07:11 AM
Custom Validator bmains ASP.NET 1.0 and 1.1 Basics 4 December 18th, 2003 11:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.