dmBridge PHP API
DMHiddenField.php
00001 <?php
00002 #
00003 # dmBridge: a data access framework for CONTENTdm(R)
00004 #
00005 # Copyright © 2009, 2010, 2011 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00013 class DMHiddenField extends DMAbstractFormField implements DMFormField {
00014 
00019    public function getHTMLTag() {
00020       $dxml = new DMDOMDocument("1.0", "utf-8");
00021       $dxml->loadXML("<div/>");
00022 
00023       $class = "dmFormField";
00024       if (!$this->isValid() && $this->isUserData()) {
00025          $msg = $this->getValidationMessage();
00026          $dxml->documentElement->appendChild($dxml->createTextNode($msg));
00027          $dxml->documentElement->appendChild($dxml->createElement('br'));
00028          $class .= " dmInvalid";
00029       }
00030       $dxml->documentElement->setAttribute("class", $class);
00031 
00032       $input = $dxml->createElement("input");
00033       $input->setAttribute("type", "hidden");
00034       $input->setAttribute("name", $this->getHTMLName());
00035       $input->setAttribute("value", DMString::websafe($this->getValue()));
00036       $dxml->documentElement->appendChild($input);
00037 
00038       return $dxml->saveHTML($dxml->documentElement);
00039    }
00040 
00041 }
00042 
 All Data Structures Functions Variables