diff --git a/composer.json b/composer.json index dcc6172..117a375 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": ">=8.1", - "nette/forms": "3.2.8", + "nette/forms": "3.2.9", "nette/application": "^3.0" }, "require-dev": { diff --git a/src/BootstrapRenderer.php b/src/BootstrapRenderer.php index ac894ad..6da04d0 100644 --- a/src/BootstrapRenderer.php +++ b/src/BootstrapRenderer.php @@ -328,7 +328,9 @@ public function render(Form $form): string public function renderBegin(): string { foreach ($this->form->getControls() as $control) { - $control->setOption(RendererOptions::_RENDERED, false); + if ($control instanceof BaseControl || $control instanceof BootstrapRow) { + $control->setOption(RendererOptions::_RENDERED, false); + } } /** @var Html $el */ @@ -462,6 +464,10 @@ public function renderControls($parent): string // note that these are NOT form groups, these are groups specified to group foreach ($parent->getControls() as $control) { + if (!$control instanceof BaseControl && !$control instanceof BootstrapRow) { + continue; + } + if ($control->getOption(RendererOptions::_RENDERED)) { continue; } diff --git a/src/Inputs/DateInput.php b/src/Inputs/DateInput.php index c1e917f..e237308 100644 --- a/src/Inputs/DateInput.php +++ b/src/Inputs/DateInput.php @@ -5,6 +5,7 @@ use Contributte\FormsBootstrap\Enums\DateTimeFormat; use DateTime; use DateTimeInterface; +use Nette\Forms\Control; use Nette\NotSupportedException; use Nette\Utils\Html; @@ -54,7 +55,7 @@ public function __construct($label = null, ?int $maxLength = null) parent::__construct($label, null); - $this->addRule(fn ($input) => DateTimeFormat::validate($this->format, $input->value), $this->invalidFormatMessage); + $this->addRule(fn (Control $input) => DateTimeFormat::validate($this->format, $input->getValue()), $this->invalidFormatMessage); $this->setFormat(static::$defaultFormat); }