Skip to content. Skip to navigation

ICTP Portal

Sections
You are here: Home Scripts check_form.js
Personal tools
Document Actions

check_form.js

Click here to get the file

Size 1 kB - File type text/plain

File contents

function checkrequired(which){
  var pass=true
  if (document.images) {
    for (i=0;i<which.length;i++) {
      var tempobj=which.elements[i]
      if (tempobj.name.substring(0,8)=="required") {
        if (((tempobj.type=="text"||tempobj.type=="textarea") &&
                                                 tempobj.value=='') ||
            (tempobj.type.toString().charAt(0)=="s" &&
                                             tempobj.selectedIndex==-1)) {
          pass=false
          break
        }
      }
    }
  }

  if (!pass) {
    alert("At least one of the required fields (marked with an asterisk) was left blank. Please complete the form then submit it again.")
    return false
  } else
    return true
}

Powered by Plone This site conforms to the following standards: