/**
  * called by BasicFunctions::hasFieldsetOnMultiCheckbox()
  * Check if form has "fieldset" and "legend" to group multiple checkbox buttons.
  * @return true if has, otherwise, false
  */
 public static function hasFieldsetOnMultiCheckbox($e)
 {
     // find if there are radio buttons with same name
     $children = $e->children();
     $num_of_children = count($children);
     foreach ($children as $i => $child) {
         if (strtolower(trim($child->attr["type"])) == "checkbox") {
             $this_name = strtolower(trim($child->attr["name"]));
             for ($j = $i + 1; $j <= $num_of_children; $j++) {
                 // if there are radio buttons with same name,
                 // check if they are contained in "fieldset" and "legend" elements
                 if (strtolower(trim($children[$j]->attr["name"])) == $this_name) {
                     if (BasicChecks::hasParent($e, "fieldset")) {
                         return BasicChecks::hasParent($e, "legend");
                     } else {
                         return false;
                     }
                 }
             }
         } else {
             return BasicChecks::hasFieldsetOnMultiCheckbox($child);
         }
     }
     return true;
 }