You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rules defined after usage of BaseControl::addFilter() method are dropped and not renderered in HTML #341
If addFilter() method is used BEFORE other rules, they are dropped and passed to HTML. Even documentation states that:
The filter is included between the validation rules and conditions and therefore depends on the order of the methods, i.e. the filter and the rule are called in the same order as is the order of the addFilter() and addRule() methods.
Fix Nette\Forms\Helpers to NOT to exit whole foreach loop, when rule is not exportable.
namespaceNette\Forms;
useNette;
useNette\Utils\Html;
useNette\Utils\Image;
useNette\Utils\Strings;
/** * Forms helpers. */finalclass Helpers
public static function exportRules(Rules$rules): array
{
$payload = [];
foreach ($rulesas$rule) {
if (!$rule->canExport()) {
if ($rule->branch) {
continue;
}
/** * 👇 this is the problem, when replaced * by continue; seems to works, but I am not sure * it doesn't break something else */break;
}
This is intentional: the browser cannot reproduce a filter written in PHP, so client validation stops at the first filter that changes the value. With continue the browser would validate the unfiltered value and could block valid input. If the rules don't depend on the filtered value, add the filter after them. In 4.0, a filter object that provides its own client rules doesn't stop the export.
Activity
dg commentedon Oct 28, 2026
This is intentional: the browser cannot reproduce a filter written in PHP, so client validation stops at the first filter that changes the value. With
continuethe browser would validate the unfiltered value and could block valid input. If the rules don't depend on the filtered value, add the filter after them. In 4.0, a filter object that provides its own client rules doesn't stop the export.