Re: Custom validation

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: simon (simon.zupan_at_stud-moderna.si)
Date: 05/28/04


Date: Fri, 28 May 2004 09:19:47 +0200

Hi,

If I get rid of the ControlToValidate property then validation function is
executed but when I set
args.isValid=false, nothing happened.
It just pass by like if I set args.isValid=true.
No difference.
Any idea?

Thank you,
Simon

"DujHoD" <J242110559@aol.com> wrote in message
news:766f7500.0405270920.381e2705@posting.google.com...
> Try getting rid of the ControlToValidate property. It's not necessary
> for a CustomValidator, and in this case, it may be what is preventing
> the ServerValidate event from firing.
>
> For client-side validation, use the ClientValidationFunction property
> of the CustomValidator.
>
>
> "simon" <simon.zupan@stud-moderna.si> wrote in message
news:<#9sV2A8QEHA.1392@TK2MSFTNGP09.phx.gbl>...
> > I have 2 <asp:textbox controls>:
> >
> > <asp:textbox id="txt1" Runat="server" ></asp:textbox>
> >
> > <asp:textbox id="txt2" Runat="server" ></asp:textbox>
> >
> > User must insert the value either in txt1 OR in txt2, so one of them
> > shouldn't be empty.
> >
> > So I use custom validator:
> >
> > <asp:CustomValidator id="valPhone" Runat="server" ErrorMessage="You
must
> > insert text1 or text2!"
> > ControlToValidate="txt2"
> > Display="Dynamic"></asp:CustomValidator>
> >
> > AND server:
> >
> > Private Sub valPhone_ServerValidate(ByVal source As Object, ByVal args
As
> > System.Web.UI.WebControls.ServerValidateEventArgs) Handles
> > valPhone.ServerValidate
> > If txt1.Text = "" And txt2.Text = "" Then
> > args.IsValid = False
> > Else
> > args.IsValid = True
> > End If
> > End Sub
> >
> > The server validation is fired only if there is some value in txt2
box.If
> > txt2.text is empty then server validation is not fired.
> > How can I solve this problem?
> >
> > I would like also to include client validation.
> >
> > Thank you,
> > Simon



Relevant Pages

  • Re: Page Submits twice
    ... Get rid of the onsubmit parameter on the form. ... function validateform { ... //do a lot validation here, if validation failes, return false; ...
    (alt.html)
  • Re: VBA Inserted Data Validation Fails
    ... Get rid of the equal sign in your list. ... Also, if you run this more than once, you need to delete the validation, ... this functionality that fails. ... speicifying any other object requirements. ...
    (microsoft.public.excel.programming)
  • Re: Validation drop down box too large
    ... Extra wide dropdown lists appear occasionally, usually if cells on the worksheet have been merged (not necessarily the cell with the data ... To get rid of them, you may have to delete the row or column and recreate the data validation. ...
    (microsoft.public.excel.misc)
  • Re: Javascript question on customvalidation
    ... Notice I removed the ControlToValidate property. ... Your custom validation will now look something like this. ... function ValidateQty(object, args) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Validation Text
    ... How do I get rid of the less then friendly "The value you entered ... How do I make the Validation Text display instead. ... Searching through the group I ... see a suggestion of Before Update on the form. ...
    (microsoft.public.access.formscoding)