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

problem to remove a required field #27

Open
francosalcedo opened this issue Jul 2, 2018 · 3 comments
Open

problem to remove a required field #27

francosalcedo opened this issue Jul 2, 2018 · 3 comments

Comments

@francosalcedo
Copy link

francosalcedo commented Jul 2, 2018

Reproduce problem: https://jsfiddle.net/oc0veLLp/9/

Hi,
I have the following problem, if I want a field to don't required (Once the form has been initialized, and this changed dynamically), I delete the "required" by javascript but if the field has other attributes such as "minLength" or "maxLength" it is still mandatory.

How can I solve this in the best way?

thanks

@Mevrael
Copy link
Owner

Mevrael commented Jul 2, 2018

Thank you for bug report.

As I see per code, minLength and maxLength validators do not check if input is empty.

I will update code in coming days. For now you can manually remove also min/max attributes.

@francosalcedo
Copy link
Author

@Mevrael
Thank you for your prompt response, I will be attentive.

@Mevrael
Copy link
Owner

Mevrael commented Aug 29, 2018

Hi @francosalcedo

I am very sorry for delay and I do believe you solved you problem by adjusting code manually, however, I would appreciate if you could do a simple PR and just add input.value.length > 0 to min/max length validators.

https://github.com/Mevrael/bunny/blob/master/src/Validation.js#L157

You can scroll this line up and check "tel" validator to see an example.

I will get my IDE and anything else on my machine this weekend and would be able just to merge, build and release new NPM version.

Thanks

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