www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > .NET

    .NET Discussion and technical support for, building, using and deploying .NET sites.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 07-28-2004, 11:48 AM
    tini tini is offline
    Registered User
     
    Join Date: Jul 2004
    Posts: 2
    Question ASP.NET form validation and W3C-validated XHTML! Anyone else care about this?

    Hello Webdevelopers !

    I just registered to this forum and i have one big question:

    Has anybody ever looked at the HTML rendered by ASP.NET? Has anybody tried to validate your website programmed in ASP.NET?
    Now most of it goes well, but i got a problem with asp:RequiredFieldvalidator, because it generates some javascript onclick-code for the submit button. I even set EnableClientScript to false because i don't want client-side form-validation.

    it also puts language="javascript" into the input type="submit"-tag and this is taht does not validate in W3C-validator?

    Anybody knows how to make ASP.NET not to put this javascript onclick-code in the input submit-tag ???
    Reply With Quote
      #2  
    Old 07-28-2004, 11:54 AM
    CardboardHammer CardboardHammer is offline
    Mercenary
     
    Join Date: Nov 2003
    Posts: 668
    If you want W3C validation, it's up to you to hack things to whatever level of validation you want.

    Personally, what I do is to write all dynamic content using div tags, turn off viewstate, and avoid using any controls that force viewstate.
    Reply With Quote
      #3  
    Old 07-29-2004, 12:36 AM
    PeOfEo's Avatar
    PeOfEo PeOfEo is offline
    Data Center Troll
     
    Join Date: Nov 2002
    Location: Auburn, AL
    Posts: 10,037
    You can also just use html forms and then call an asp.net script. That way you are in complete control. Basically I do not use the built in validaotrs. The best thing would be to write some java script by hand to catch the users with java script enabled before they post to the server, then run a server side script to make sure the form values are correct for those who do not have java script enabled. You may not be able to get rid of the view state tag completely. But when you do a form, make sure you put in your own name and id etc. If you do not the server will put in stuff like __ and that will kill your validation. I do not like having invalid code so I would do my forms client side. Plus I know there are lots of clients who will not settle for invalid code either. Some clients like a little thing that says the page was made correctly... so they know they are getting their moneys worth.

    The whole advantage of using the built in validators is because they use the java script and you do not have to do it by hand. If you want to ditch the js, just on the page under the sub/function that is called when the button is clicked use an if statement (or a case statement).
    Code:
    if txtbox1.text = ""and txtbox2.text = "" then
       lblblank.visible = true
       lblblank2.visible = true
    else if txtbox1.text = "" then
       lblblank.visisible = true
    else if txtbox2.text = "" then
       lblblank2.visible = true
    else
       fire the code
    end if
    Just put the error messages in the lables. That will do what you want.

    Last edited by PeOfEo; 07-29-2004 at 12:42 AM.
    Reply With Quote
      #4  
    Old 07-30-2004, 05:45 AM
    tini tini is offline
    Registered User
     
    Join Date: Jul 2004
    Posts: 2
    thank you very much.

    indeed, the built-in form-validation are quite handy. but when it comes down to W3C-valid HTML, it's just a pain in the a**. as a matter of fact, M$ doesn't care a lot about W3C-standards, Internet Explorer is just the best example.

    as a PHP, ASP web-developer i was used to do all the form validation by a server-side script once the form was sent, so i was really amazed by the ASP.NET form-validators. but i DO care about W3C-compliant code, so i won't use them but do the validation the same old way :-(

    i.e is the field filled, is it numeric, is it > 0 etc ;-)
    Reply With Quote
      #5  
    Old 07-30-2004, 11:52 AM
    PeOfEo's Avatar
    PeOfEo PeOfEo is offline
    Data Center Troll
     
    Join Date: Nov 2002
    Location: Auburn, AL
    Posts: 10,037
    Quote:
    Originally posted by tini
    thank you very much.

    indeed, the built-in form-validation are quite handy. but when it comes down to W3C-valid HTML, it's just a pain in the a**. as a matter of fact, M$ doesn't care a lot about W3C-standards, Internet Explorer is just the best example.

    as a PHP, ASP web-developer i was used to do all the form validation by a server-side script once the form was sent, so i was really amazed by the ASP.NET form-validators. but i DO care about W3C-compliant code, so i won't use them but do the validation the same old way :-(

    i.e is the field filled, is it numeric, is it > 0 etc ;-)
    you should do it client side too, write a little js. It saves you a little bandwidth and saves the users a little time. Asp.net 2.0 is going to clean up a lot of the markup. I am going to use the validators when 2.0 comes out.
    Reply With Quote
      #6  
    Old 08-12-2004, 09:36 PM
    hugmup hugmup is offline
    Registered User
     
    Join Date: Aug 2004
    Posts: 2
    Microsoft has made the beta of Visual Studio 2005 available for download. There will be an Express version for hobbyist programmers (who outnumber professional programmers 2 to 1) that will cost less than $50 per language. I downloaded it and so far as I can tell the feature set is pretty complete.

    Microsoft claims, and you can verify it yourself by downloading the beta and trying it, that VS 2005 will produce valid XHTML 1.0 code, with the exception of a few controls, which they document in detail.

    The current version of VS doesn't know about XHTML.
    __________________
    Ken
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:21 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.