-
-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Description
When I use back references in pattern rule (Form::PATTERN), it creates different behaviour on client side and server side in validation, because in Validator class, input pattern is bracked.
Example pattern: (.)\1{2,}
Different back reference:
- Client side is
\1 - Server side is
\2
Before I create PR, I would like to know, why pattern is bracked. There are two options: remove these bracket, or add to brackes (here, here).
use Nette\Forms\Form;
$form = new Form;
#$form->getElementPrototype()->novalidate = true; // uncomment = validate by server side
$form->addText('name', 'Name:')
->addRule(
Form::PATTERN,
'Please, write text with three same characters consecutively',
'(.)\1{2,}'
);
$form->addSubmit('send', 'Register');
if ($form->isSuccess()) {
echo '<h2>Form was submitted and successfully validated</h2>';
}
echo $form; // renders the formreference bug reporting in czech forum: https://forum.nette.org/cs/25332-invert-regularniho-vyrazu#p168360
Metadata
Metadata
Assignees
Labels
No labels