SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    Location
    Felton
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need some advice on approach to form validation

    I'm in need of some advice for how to approach form validation. I've been reading the Novice to Ninja book, but I'm more novice.

    I have a form comprised of 8 fieldsets that contain (first, last, email, dept, mail stop). I need to create rules to meet the following specification.

    • A valid team nomination is 2 or more individuals.
    • A team nomination may include up to 8 individuals.
    • All fields for each individual are required. e.g., you touch the first field for #3, all fields for #3 is required (first, last, email, mail stop, dept).


    Is it better to write conditional statements for each set of fields looking for val().length != 0 and build up an error message or is there a more efficient method using form validation plugin rules?

    thanks,

    Peter

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,688
    Mentioned
    100 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by peterm View Post
    I'm in need of some advice for how to approach form validation. I've been reading the Novice to Ninja book, but I'm more novice.

    I have a form comprised of 8 fieldsets that contain (first, last, email, dept, mail stop). I need to create rules to meet the following specification.

    • A valid team nomination is 2 or more individuals.
    • A team nomination may include up to 8 individuals.
    • All fields for each individual are required. e.g., you touch the first field for #3, all fields for #3 is required (first, last, email, mail stop, dept).
    The first thing you need to do is to ensure that your server-side script (PHP, ASP, .NET, etc) performs the above validation with the submitted form.

    Why? JavaScript is optional so you need to first be prepared for when your script is not used.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Tags for this Thread

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
  •