SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru Angry Coder's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How can I make all the fields required in my form?

    Hello,

    I want to make all the fields required in my form. It's a long long long form so I think I need some code to loop over the form's objects.

    Your help is greatly appreciated.
    Why It Doesn't Work?!

  2. #2
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    NY, USA
    Posts
    712
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Angry Coder
    Hello,

    I want to make all the fields required in my form. It's a long long long form so I think I need some code to loop over the form's objects.

    Your help is greatly appreciated.
    the simplest way would be to loop through the form elements array, and use a switch to determine the element type at each iteration, and what action to take with it. You can get pretty complex... but some people have already made it easy for you. Unless you want to write your own for learning purposes. I'd recommend a pre-made free script.

    http://www.google.com/search?hl=en&q...form+validator

    I wrote my own some time ago... but you'll probably find something better out there. If not I'll see if I can find it for you.

  3. #3
    SitePoint Member
    Join Date
    Sep 2002
    Location
    W. Vancouver
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this one works pretty without having to specifically identify form fields...

    http://www.faqts.com/knowledge_base/...d/1756/fid/129

  4. #4
    SitePoint Guru Angry Coder's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GREAT!

    Thank you
    Why It Doesn't Work?!


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
  •