SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form Validation on the Client Side

    These comments are in regards to the SitePoint.com article 'Form Validation on the Client Side'.

    I'd just like to point out that ASP.NET has some very powerful form validation controls built in already.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  2. #2
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    While those ASP.NET client-side validation routines make some use of the W3C DOM, some of them also rely on IE-specific DOM features such as .innerText, and IE's Event model. So they're not all going to work in other browsers.

  3. #3
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Actually, ASP.NET validation controls are browser dependent.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  4. #4
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Jeremy W.
    Actually, ASP.NET validation controls are browser dependent.
    Yes, that's what he said.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  5. #5
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    "some of them also rely on IE-specific DOM features such as .innerText, and IE's Event model. So they're not all going to work in other browsers."

    ^ ^ ^

    I read the above as ".NET doesn't know the difference, and if you aren't careful will send tags to Netscape that it doesn't know what to do with", which is in fact untrue. It will only send IE-specific tags to IE. It's the way in which ASP.NET controls are programmed.

    For instance, the calendar control. For IE, it displays an amazingly fully functional piece of JS/CSS which does in fact use proprietary tags.

    For NS, it does the same thing, with different scripting.

    For older versions of IE, it just uses CSS and some lighter JS.

    For other browsers, it displays links, which allow you to mimick the functionality by navigating to different pages.



    Then again, maybe I'm just reading his statement wrong. Basically, in order to send the wrong tags to the wrong browser, the developer would need to purposefully code in "for [x] browser, use wrong tags"
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  6. #6
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I read the above as ".NET doesn't know the difference, and if you aren't careful will send tags to Netscape that it doesn't know what to do with", which is in fact untrue. It will only send IE-specific tags to IE. It's the way in which ASP.NET controls are programmed.
    So why are some of the samples linked above sending code using document.all to mozilla?

  7. #7
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Jeremy W.
    Basically, in order to send the wrong tags to the wrong browser, the developer would need to purposefully code in "for [x] browser, use wrong tags"
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  8. #8
    SitePoint Member
    Join Date
    Sep 2002
    Location
    Bulgaria
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even if Microsoft can handle one or two of the major browsers I wouldn't believe it they can support all.

    And cloacking isn't the best way to go with interoperability and portability.

  9. #9
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some of the document.all calls in those samples are included in the human-written code (and are therefore the fault of the author), but not all of them.

    Unless MS have screwed up, and this example doesn't match the source code that supposedly generated it, then ASP.NET is sending this lot to mozilla:
    [line breaks inserted to make it more readable]
    Code:
    <script language="javascript"><!--
    var Page_Validators =  new
       Array(document.all["RequiredFieldValidator1"], 
          document.all["RequiredFieldValidator2"], 
          document.all["RequiredFieldValidator3"]);
    // -->
    </script>

  10. #10
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  11. #11
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IMHO the definitive guide to form validation (methodology, not necessarily code) is this:
    http://www.adopenstatic.com/resource...Validation.asp
    Last edited by M@rco; Oct 21, 2002 at 11:22.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  12. #12
    Anonymous
    SitePoint Community Guest
    Validation code is very nice but along with this if u r providing code for the form which uses it,will be better.

  13. #13
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.peterbailey.net/fValidate/

    [img]images/smilies/biggrin.gif[/img]

    BTW, good article.
    Last edited by beetle; Oct 9, 2003 at 01:01.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  14. #14
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    M@rco, that's a great read on validation - thanks for the link.

    beetle, fValidate... Wow! Excellent work! I'll be recommending this.

  15. #15
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All this time, Mike, and you're just now seeing fValidate?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

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