Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number input with maxlength validation always fails #329

Closed
Gappa opened this issue May 2, 2024 · 2 comments
Closed

Number input with maxlength validation always fails #329

Gappa opened this issue May 2, 2024 · 2 comments

Comments

@Gappa
Copy link

Gappa commented May 2, 2024

Version: NetteForms.js 3.3.6

Bug Description

Number input with maxlength validation always fails - even if it is less or the same as the defined maximum.

Steps To Reproduce

$form = new \Nette\Application\UI\Form;
$form->addInteger('year', 'Year')
	->addRule($form::MaxLength, null, 4)
	->setRequired(true);
$form->addSubmit('save', 'Save');
<form method="post" action="./">
	<input type="number" name="year" maxlength="4" id="frm-form-title" required="" data-nette-rules="[{&quot;op&quot;:&quot;:filled&quot;,&quot;msg&quot;:&quot;Název: pole je povinné.&quot;},{&quot;op&quot;:&quot;:integer&quot;,&quot;msg&quot;:&quot;Název: hodnota musí být celočíselná.&quot;},{&quot;op&quot;:&quot;:maxLength&quot;,&quot;msg&quot;:&quot;Název: hodnota nesmí mít více než 4 znaků.&quot;,&quot;arg&quot;:4}]"> 
	<input type="submit" name="save" value="Save">
</form>

Expected Behavior

Form is submitted without JS validation error.

Possible Solution

It works fine with NetteForms.js 3.3.5:

@dg
Copy link
Member

dg commented May 5, 2024

@Gappa Can you please try it?

@Gappa
Copy link
Author

Gappa commented May 6, 2024

It's working now, thanks! 👍

@Gappa Gappa closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants