Validating Text field against database.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chandhseke
    New Member
    • Jun 2009
    • 92

    Validating Text field against database.

    I have developed a web page using ASP classic, I am using VBScript for database connectivity... The web application is working fine, but i am now working on a new enhancement requirement where i need to validate the ID# entered into a text box by the users against a new database. This validation should happen as soon as the User enters his ID#.

    Once the user enters the ID#, it should check the availabity of the ID# in the database table, if it does not exists a Message should pop up saying "Invalid ID number entered"

    Here is the code for your review.

    <tr>
    <td bordercolor="#F FFFFF" bgcolor="#33339 9"> <div align="center"> <font color=#FFFFFF
    size=2 face="Verdana, Arial, Helvetica, sans-serif"><strong> PeopleSoft ID</strong></font></div></td>
    <td bordercolor="#F FFFFF"> <input maxlength=6 size=13 name=ID />
    </td>
    </tr>

    In the above sample code snippet, we need to add validation against database..And this validation should happpen before the form submission
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Originally posted by chandhseke
    i am now working on a new enhancement requirement where i need to validate the ID# entered into a text box by the users against a new database. This validation should happen as soon as the User enters his ID#.
    sounds like a job for AJAX

    Originally posted by chandhseke
    In the above sample code snippet, we need to add validation against database..And this validation should happpen before the form submission
    would it be that tragic, if you do the validation along with the form submission?

    Originally posted by chandhseke
    Code:
    <tr> 
        <td bordercolor="#FFFFFF" bgcolor="#333399"> <div align="center"><font color=#FFFFFF 
          size=2 face="Verdana, Arial, Helvetica, sans-serif"><strong>PeopleSoft ID</strong></font></div></td>
        <td bordercolor="#FFFFFF"> <input maxlength=6 size=13 name=ID />
            </td>
    </tr>
    your HTML is horribly out of date. the <font> tag is deprecated for decades (feels like) now and every attribute value should be quoted. (real XHTML will error out otherwise) and tables should not be used for layout (that's the job of CSS).

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by Dormilich
      tables should not be used for layout (that's the job of CSS).
      Care to elaborate on that? I know (almost) nothing about html and css but I have to write some documentation in html now and then. I always happily use tables to display data in tabular form ... all I knew was that css is able to fiddle with the borders, captions, relative sizes of the tables ... I can't find anything appropriate in the w3schools either.

      kind regards,

      Jos

      ps. sorry for intruding this thread ;-)

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Originally posted by JosAH
        Care to elaborate on that? I know (almost) nothing about html and css but I have to write some documentation in html now and then.
        tables for page layout were used when the CSS support of the browsers was sparse (80s and early 90s). so tables (with border="0") were used to put all elements in place, like a grid.

        the disadvantage is, that the mark-up is neither semantic, nor readable (despite being much larger in size, which eventually you have to pay with traffic costs and rendering speed).

        but now that CSS is widely supported (more or less also in *cough* IE) all the positioning and eye candy can be done using CSS.


        check out ALA's Primer Part 2 (Part 1), there you should find some useful resources. or ask drhowarddrfine or David Laakso (and some other HTML/CSS experts) on this matter.

        Originally posted by JosAH
        I always happily use tables to display data in tabular form ...
        I do not put that in question, if you have tabular data, tables are the way to go.

        Originally posted by JosAH
        all I knew was that css is able to fiddle with the borders, captions, relative sizes of the tables ... I can't find anything appropriate in the w3schools either.
        the ultimate resource of CSS 2.1 (aka TechSpec)

        comprehensive look-up site (german) ← well organized and compact

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Thanks for the links (I put them in my bookmarks already ;-) The first link gave me the clue: by using divs I can get a similar look as with those tables; it's nice. For real tabular data I'll use tables otherwise I use those divs with their css layout tags.

          kind regards,

          Jos

          Comment

          • Curtis Rutland
            Recognized Expert Specialist
            • Apr 2008
            • 3264

            #6
            Yeah, that's what I've learned Jos. Tables are not for layout anymore. Real, tabled data goes in them, otherwise, divs and css. Apparently one big difference is properly laid out HTML/CSS with divs rather than tables is much more search-engine-optimizable.

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #7
              Originally posted by insertAlias
              otherwise, divs and css.
              not to forget lists & CSS…

              Comment

              • chandhseke
                New Member
                • Jun 2009
                • 92

                #8
                But my question is different..Let me make a long story into short : I am working as a Support and Maintenance enginner for web applications..T his a new requirement from our customers.. We are using ASP classic, JavaScript and VB script.. In one of our applications, when the employee enters thier Employee_ID they need to check this against database for the availabilty as the employees FAT fingured few times and the records created with wrong EMp_ID's.. So as soon the Employee enters thier ID in the text box, it should check against a database table ESH..Any suggestions would be appreciated,,

                Many Thanks

                Comment

                • Dormilich
                  Recognized Expert Expert
                  • Aug 2008
                  • 8694

                  #9
                  well, to cite me again…

                  Originally posted by Dormilich
                  sounds like a job for AJAX

                  would it be that tragic, if you do the validation along with the form submission?
                  unfortunately, I can't help you with ASP and VB script.

                  Comment

                  • Curtis Rutland
                    Recognized Expert Specialist
                    • Apr 2008
                    • 3264

                    #10
                    We do, however, have an ASP Classic Forum that you should visit.

                    Comment

                    • chandhseke
                      New Member
                      • Jun 2009
                      • 92

                      #11
                      Thanks for your kind help on guiding me to the correct point..

                      Many thanks

                      Comment

                      Working...