SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Mar 2006
    Posts
    701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Validate an array of form elements

    I have a form with some input name['gr'],name['en'] etc those are dynamically created.
    Is there a way to validate if they are not empty?
    My idea is loop with the name array but I have not test it yet.
    I may use prototypejs
    Dimis

  2. #2
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function validateForm(form) {
    for (var i in form.elements) if (form.elements[i].value == "") return false;
    return true;
    }

  3. #3
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    http://www5.brinkster.com/hiflyer/js...mchecktest.htm

    This might give you some inspiration.
    Ian Anderson
    www.siteguru.co.uk


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
  •