Results 1 to 15 of 15

Thread: [2005] CompareValidator question !

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    [2005] CompareValidator question !

    Hi ,

    can a compareValidator compare a unique field
    i saw the types Integer ; String ..
    normally i used to compare 2 field
    wondering if i can use it for one field ?
    so (i will not use CustomeValidator in some case )

    Thanks

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] CompareValidator question !

    When you use a compare validator, you need to compare it to something. Comparing something with itself doesn't make sense.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: [2005] CompareValidator question !

    Yes logically ,

    i found this mistake on MSDN training on Question & Answers
    they say :

    Q-To check if Date is Correct what you will use ?
    A- CompareValidator (compare with Date type )


    Thanks !

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] CompareValidator question !

    Very nice, do you have a link?

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: [2005] CompareValidator question !

    Here You The Link
    page 44
    Question 6

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] CompareValidator question !

    Thanks for that, I quite enjoyed it. Even more than that I enjoyed the waiting process followed by their 'CAPTCHA' image verification system.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: [2005] CompareValidator question !

    Quote Originally Posted by mendhak
    Even more than that I enjoyed the waiting process followed by their 'CAPTCHA' image verification system.
    Yep a little but when you download you will see its faster !

    sorry !

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] CompareValidator question !

    I never paid attention in French class, but this

    6. Déterminer si le format de date est correct.
    CompareValidator (pour une comparaison avec le type Date)
    Does this mean

    Determine if the format of the date is correct
    CompareValidator (for comparison with a date type)
    ?

    If I'm now understanding you correctly, are you trying to determine if a date entered in a field is valid date? If so, you can specify the "Type" property of the CustomValidator but this does not work for all date formats, I believe it is quite limited in what it validates against data types...

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: [2005] CompareValidator question !

    Yes Exactly !
    You want to mean CompareValidator ...

    but they answered using compareValidator
    That why i asked if can we use for a 1 field
    as they wrote

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] CompareValidator question !

    Hmm... you can use the CompareValidator to validate whether something entered in a field is a valid type of data, but you cannot compare it to itself.

    The answer, however, is still incorrect and you have indeed found a fallacy. Use a regular expression validator to find out if it's a date.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: [2005] CompareValidator question !

    Quote Originally Posted by mendhak
    Use a regular expression validator to find out if it's a date.
    do you mean CustomValidator ?

  12. #12
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] CompareValidator question !

    No, a regular expression validator. It's different. You can specify a regular expression to match a pattern. Are you familiar with regular expressions? Think of it as a 'meta language' to describe what a string should look like.

    For example, if I want to specify that I want to match an email address and ensure that the text entered is an email address, I can use this regular expression

    Code:
    \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b
    The regular expression validator, when given that, will look at the text input into whatever field you've specified and match it against that pattern to ensure that it does follow those rules.

    Similarly, you can use a regular expression validator for a date string.

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: [2005] CompareValidator question !

    Yes i know
    Using it as Regex(preg_match ) with PHP
    Never used on Asp.Net atm



    Thanks !

  14. #14
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] CompareValidator question !

    I think you'll like it in ASP.NET. There is a codebehind implementation, a Regex class you can use. Give it a whirl. There's also a compiled option to make your pattern matches faster.

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: [2005] CompareValidator question !

    Quote Originally Posted by mendhak
    I think you'll like it in ASP.NET. There is a codebehind implementation, a Regex class you can use. Give it a whirl. There's also a compiled option to make your pattern matches faster.
    Thanks m8 for the info , sure i will see it !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width