Example #1
0
 /**
  * Get the javascript part for this field
  *
  * @return string
  */
 public final function getJsPart()
 {
     $validators = array();
     foreach ($this->validators as $validator) {
         $validators[] = $validator->toJsonData();
     }
     $output = '<script type="text/javascript">';
     $output .= '(function(){var field = $("#' . $this->attr->get("id") . '"); if(!field.data("formtablefield")) new FormTableField(field, ' . json_encode($validators) . ')})();';
     $output .= '</script>';
     return $output;
 }
Example #2
0
 /**
  * Enable file upload for this form
  *
  * @return self
  */
 public function enableFileUpload()
 {
     $this->attr->add("enctype", "multipart/form-data");
     return $this;
 }