Form fields can now be marked as hidden

This commit is contained in:
Sam Georges 2014-10-08 18:55:09 +11:00
parent 2c4317f8f2
commit 8d5253930d
2 changed files with 7 additions and 0 deletions

View File

@ -83,6 +83,11 @@ class FormField
*/ */
public $disabled = false; public $disabled = false;
/**
* @var bool Specify if the field is hidden. Hiddens fields are not included in postbacks.
*/
public $hidden = false;
/** /**
* @var bool Specifies if this field stretch to fit the page height. * @var bool Specifies if this field stretch to fit the page height.
*/ */
@ -245,6 +250,7 @@ class FormField
if (array_key_exists('required', $config)) $this->required = $config['required']; if (array_key_exists('required', $config)) $this->required = $config['required'];
if (array_key_exists('disabled', $config)) $this->disabled = $config['disabled']; if (array_key_exists('disabled', $config)) $this->disabled = $config['disabled'];
if (array_key_exists('hidden', $config)) $this->hidden = $config['hidden'];
if (array_key_exists('stretch', $config)) $this->stretch = $config['stretch']; if (array_key_exists('stretch', $config)) $this->stretch = $config['stretch'];
if (isset($config['valueFrom'])) $this->valueFrom = $config['valueFrom']; if (isset($config['valueFrom'])) $this->valueFrom = $config['valueFrom'];

View File

@ -1,3 +1,4 @@
<?php foreach ($fields as $field): ?> <?php foreach ($fields as $field): ?>
<?php if ($field->hidden) continue; ?>
<?= $this->makePartial('field-container', ['field' => $field]) ?> <?= $this->makePartial('field-container', ['field' => $field]) ?>
<?php endforeach ?> <?php endforeach ?>