case à cocher dans formulaire

This commit is contained in:
fredtempez 2019-01-23 13:07:28 +01:00
parent 66d61cd123
commit dab2cac843
2 changed files with 10 additions and 2 deletions

View File

@ -32,13 +32,15 @@ class form extends common {
const TYPE_TEXT = 'text';
const TYPE_TEXTAREA = 'textarea';
const TYPE_DATETIME = "date";
CONST TYPE_CHECKBOX = "checkbox";
public static $types = [
self::TYPE_TEXT => 'Champ texte',
self::TYPE_TEXTAREA => 'Grand champ texte',
self::TYPE_MAIL => 'Champ mail',
self::TYPE_SELECT => 'Sélection',
self::TYPE_DATETIME => 'Date'
self::TYPE_DATETIME => 'Date',
self::TYPE_CHECKBOX => 'Case à cocher'
];
/**
@ -184,6 +186,9 @@ class form extends common {
case self::TYPE_DATETIME:
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
break;
CASE self::TYPE_CHECKBOX:
$filter = helper::FILTER_BOOLEAN;
break;
default:
$filter = helper::FILTER_STRING_SHORT;
}

View File

@ -32,7 +32,10 @@
'id' => 'formInput_' . $index,
'label' => $input['name'],
'vendor' => 'flatpickr'
]); ?>
]); ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
); ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'capcha'])): ?>