Example #1
0
 /**
  * render the hidden input element
  */
 public function render()
 {
     // check result of validity checks of parameters passed to this Input element
     $this->checkValidity();
     $output = '';
     // I will assume style adjustments apply to the container div if there are more
     // checkboxes and that it will apply to the checkbox if there is only one.
     // if it is a collection of checkboxes the property "values" is filled, otherwise the property "value"
     if (!empty($this->values)) {
         $output .= $this->renderMultipleCheckboxes();
     } else {
         $output .= $this->renderSingleCheckbox();
     }
     // when posting, also send a hidden field so that if none of the options are selected
     // we still know that the checkbox has been posted
     $hidden = new HiddenInput($this->name . '-isPosted', 1);
     $output .= $hidden->render();
     $output .= $this->renderInvalidations();
     // return or echo output
     return $output;
 }
Example #2
0
 public function render($settings = array(), $force = false)
 {
     foreach ($settings as $set => $val) {
         $this->{$set} = $val;
     }
     if (!$this->editable && !$force) {
         return false;
     }
     $out = "";
     $out .= $this->before_tag();
     if ($this->errors) {
         $this->add_class("error_field");
     }
     if ($this->unchecked_value !== false) {
         $hidden = new HiddenInput($this->name, array("prefix" => $this->prefix, "value" => $this->unchecked_value));
         $out .= $hidden->render();
     }
     if ($this->value == $this->checked_value) {
         $this->checked = "checked";
     } else {
         $this->value = $this->checked_value;
     }
     $out .= sprintf($this->template, $this->make_attributes(), $this->tag_content());
     if ($this->label && $this->prefix) {
         $out .= sprintf($this->label_template, $this->prefix . "_" . $this->name, $this->label);
     } elseif ($this->label) {
         $out .= sprintf($this->label_template, $this->id, $this->label);
     }
     if ($this->errors) {
         foreach ($this->errors as $error) {
             $out .= sprintf($this->error_template, $error);
         }
     }
     $out .= $this->after_tag();
     return $out;
 }
Example #3
0
 function management()
 {
     $out = array();
     // carry along all the completed forms as hidden fields
     foreach ($this->completed as $prev_form) {
         foreach ($prev_form->fields as $name => $field) {
             $bf = new BoundField($prev_form, $field, $name);
             $out[] = $bf->as_hidden();
         }
     }
     // output step
     $hidden = new HiddenInput();
     $out[] = $hidden->render($this->step_field, $this->step);
     return join("\n", $out);
 }
Example #4
0
 function importHiddenNode($util)
 {
     $name = $util->attributeValue('name');
     $value = $util->attributeValue('value', XmlUtility::OPTIONAL);
     $input = new HiddenInput($name, $value);
     $this->inputs[$name] = $input;
     $this->output .= $input->getTemplateData();
     $this->current_input = $input;
 }
 function toHTML()
 {
     $ret = HiddenInput::toHTML() . $this->label->toHTML();
     return $ret;
 }