+ Reply to Thread
Results 1 to 6 of 6

Thread: validation

  1. #1
    Barn Loyal todd2006 is an unknown quantity at this point todd2006's Avatar
    Join Date
    Mar 2008
    Posts
    889
    Rep Power
    4

    validation

    Hi,

    I have 6 subject and each subject has 4 fields which the admin has fill.

    Out of 6 subjects the admin has to enter data for 4 subjects

    So here is the html design for it can someone tell me how my validation will be

    todd

    Code:
    <table>
    <thead>
    <tr>
    <th>Title</th>
    <th>CourseNo</th>
    <th>Course Hrs</th>
    <th>Instructor</th>
    <th>Room</th>
    </tr>
    </thead>
    
    <tr>
    <td>Maths</td>
    <td><input type="text" name="courseone" id="courseone" value=""></td>
    <td><input type="text" name="courseHrsone" id="courseHrsone" value=""></td>
    <td><input type="text" name="Instructorone" id="Instructorone" value=""></td>
    <td><input type="text" name="Roomone" id="Roomone" value=""></td>
    </tr>
    
    <tr>
    <td>Science</td>
    <td><input type="text" name="coursetwo" id="coursetwo" value=""></td>
    <td><input type="text" name="courseHrstwo" id="courseHrstwo" value=""></td>
    <td><input type="text" name="Instructortwo" id="Instructortwo" value=""></td>
    <td><input type="text" name="Roomtwo" id="Roomtwo" value=""></td>
    </tr>
    
    <tr>
    <td>Social Science</td>
    <td><input type="text" name="coursethree" id="coursethree" value=""></td>
    <td><input type="text" name="courseHrsthree" id="courseHrsthree" value=""></td>
    <td><input type="text" name="Instructorthree" id="Instructorthree" value=""></td>
    <td><input type="text" name="Roomthree" id="Roomthree" value=""></td>
    </tr>
    
    <tr>
    <td>Arts</td>
    <td><input type="text" name="coursefour" id="coursefour" value=""></td>
    <td><input type="text" name="courseHrsfour" id="courseHrsfour" value=""></td>
    <td><input type="text" name="Instructorfour" id="Instructorfour" value=""></td>
    <td><input type="text" name="Roomfour" id="Roomfour" value=""></td>
    </tr>
    
    <tr>
    <td>PT</td>
    <td><input type="text" name="coursefive" id="coursefive" value=""></td>
    <td><input type="text" name="courseHrsfive" id="courseHrsfive" value=""></td>
    <td><input type="text" name="Instructorfive" id="Instructorfive" value=""></td>
    <td><input type="text" name="Roomfive" id="Roomfive" value=""></td>
    </tr>
    
    <tr>
    <td>Social Studies</td>
    <td><input type="text" name="coursesix" id="coursesix" value=""></td>
    <td><input type="text" name="courseHrssix" id="courseHrssix" value=""></td>
    <td><input type="text" name="Instructorsix" id="Instructorsix" value=""></td>
    <td><input type="text" name="Roomsix" id="Roomsix" value=""></td>
    </tr>
    
    </table>
    

  2. #2
    Barn Frequenter BLaaaaaaaaaarche will become famous soon enough BLaaaaaaaaaarche will become famous soon enough BLaaaaaaaaaarche's Avatar
    Join Date
    Mar 2008
    Posts
    188
    Rep Power
    5

    Why are you using JavaScript to validate? Use ASP or another server side script.
    "You'll never be as perfect as BLaaaaaaaaarche."

  3. #3
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Quote Originally Posted by BLaaaaaaaaaarche View Post
    Why are you using JavaScript to validate? Use ASP or another server side script.
    Well, typically it's a good idea to handle any validation that you can on the client-side AS WELL AS server-side.

    Quote Originally Posted by todd2006 View Post
    So here is the html design for it can someone tell me how my validation will be
    I'm not going to tell you how exactly...but using JavaScript you can iterate through those fields and check if they have a value. Keep a counter and if, by the end of the iteration, there are 4 values, then the validation should pass.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  4. #4
    Barn Frequenter BLaaaaaaaaaarche will become famous soon enough BLaaaaaaaaaarche will become famous soon enough BLaaaaaaaaaarche's Avatar
    Join Date
    Mar 2008
    Posts
    188
    Rep Power
    5

    Fine with me, but I absolutely HATE websites that have a popup that says, "You are missing a required field". After I see that, I have to click it and say, "OK", and re-enter. A-N-N-O-Y-I-N-G! I rather submit the form and have the server kick back an error message on the page. I think it is cleaner and more professional looking.
    "You'll never be as perfect as BLaaaaaaaaarche."

  5. #5
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Quote Originally Posted by BLaaaaaaaaaarche View Post
    Fine with me, but I absolutely HATE websites that have a popup that says, "You are missing a required field". After I see that, I have to click it and say, "OK", and re-enter. A-N-N-O-Y-I-N-G! I rather submit the form and have the server kick back an error message on the page. I think it is cleaner and more professional looking.
    You don't have to use a popup, just set the visibility of a div or something to display a message. I agree...the Javascript alert is annoying...which is why it's good to use a combination of div's and CSS with the JavaScript validation.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  6. #6
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Agreed -- but the client-side script doesn't HAVE to use a popup to indicate which fields are missing, invalid or whatever. I agree, it's much cleaner to put some kind of indication on the page near the missing field. Of course the ASP.NET validators make this kinda moot anyway.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

+ Reply to Thread

Similar Threads

  1. Programmatically Add Item to Validation Summary
    By jmurrayhead in forum .NET Code Samples
    Replies: 3
    Last Post: January 18th, 2011, 01:25 PM
  2. date validation
    By todd2006 in forum JavaScript Programming
    Replies: 3
    Last Post: July 6th, 2008, 12:39 PM
  3. textbox validation
    By todd2006 in forum JavaScript Programming
    Replies: 6
    Last Post: July 2nd, 2008, 02:30 PM
  4. checkbox validation
    By todd2006 in forum JavaScript Programming
    Replies: 3
    Last Post: June 18th, 2008, 08:22 PM

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

SEO by vBSEO