Add little validation with property not found

This commit is contained in:
Julio Cesar Laura
2012-12-17 09:13:25 -04:00
parent ae4fb31012
commit 244bf49dad

View File

@@ -384,14 +384,18 @@ class dynaFormHandler
} }
foreach ($av as $e) { foreach ($av as $e) {
$xnode = $this->root->getElementsByTagName($e)->item(0); $xnode = $this->root->getElementsByTagName($e)->item(0);
if ($xnode->nodeType == XML_ELEMENT_NODE) { if (isset($xnode->nodeType)) {
$dropednode = $this->root->removeChild($xnode); if ($xnode->nodeType == XML_ELEMENT_NODE) {
/* evaluation field aditional routines */ $dropednode = $this->root->removeChild($xnode);
$xpath = new DOMXPath($this->dom); /* evaluation field aditional routines */
$nodeList = $xpath->query("/dynaForm/JS_$e"); $xpath = new DOMXPath($this->dom);
if ($nodeList->length != 0) { $nodeList = $xpath->query("/dynaForm/JS_$e");
$tmp_node = $nodeList->item(0); if ($nodeList->length != 0) {
$this->root->removeChild($tmp_node); $tmp_node = $nodeList->item(0);
$this->root->removeChild($tmp_node);
}
} else {
print("[Class dynaFormHandler] ERROR: The \"$e\" element doesn't exist!<br>");
} }
} else { } else {
print("[Class dynaFormHandler] ERROR: The \"$e\" element doesn't exist!<br>"); print("[Class dynaFormHandler] ERROR: The \"$e\" element doesn't exist!<br>");