# Verify Form # if (isset($formfields['deleted']) && $formfields['deleted'] || isset($formfields['allow_missing']) && $formfields['allow_missing']) { # Hack, modify fields to unset required flag foreach ($fields as $k => $v) { unset($fields[$k]['#required']); } unset($fields['category']['#elements']['category']['#required']); unset($fields['cite_osdi02']['#elements']['cite_osdi02']['#required']); } # hack since '' == 0 will evaluate to true and thus, "No" # will incorrectly be selected if (strcmp($formfields['cite_osdi02'], '') == 0) { unset($formfields['cite_osdi02']); } FormValidate($form, $errors, $fields, $formfields); if (!(isset($formfields['allow_missing']) && $formfields['allow_missing'])) { $type = $formfields['type']; if (isset($also_required[$type])) { foreach ($also_required[$type] as $f) { if (!field_set($f)) { $errors[$fields[$f]['#label']] = "Required for {$type} type."; } } } if (field_set('cite_osdi02') && !$formfields['cite_osdi02'] && !field_set('no_cite_why')) { $errors[$fields['cite_osdi02']['#label']] = "Must specify reason."; } } if ($formfields['category'] == 'Other') { if (field_set('category_other')) {
function FormValidate($form, &$errors, $fields, &$submitted, $parent_label = '') { foreach ($fields as $name => $attributes) { switch ($attributes['#type']) { case "textfield": case "password": case "hidden": case "submit": case "checkbox": case "radio": case "select": case "textarea": FormValidateElement($name, $errors, $attributes, $submitted, $parent_label); break; case "checkboxes": while (list($subname, $subattrs) = each($attributes['#boxes'])) { FormValidateElement($subname, $errors, $subattrs, $submitted, CombineLabels($parent_label, $attributes)); } break; case "table": FormValidate($form, $errors, $attributes['#fields'], $submitted, CombineLabels($parent_label, $attributes)); break; case "list": case "vlist": while (list($subname, $subattrs) = each($attributes['#elements'])) { FormValidateElement($subname, $errors, $subattrs, $submitted, CombineLabels($parent_label, $attributes)); } break; case "file": FormValidateFileUpload($name, $errors, $attributes, $parent_label); break; case "display": break; default: $errors[$name] = "Invalid slot type: " . $attributes['#type']; break; } } }