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

Danger setValue #114

Closed
nechutny opened this issue Mar 6, 2016 · 1 comment
Closed

Danger setValue #114

nechutny opened this issue Mar 6, 2016 · 1 comment

Comments

@nechutny
Copy link

@nechutny nechutny commented Mar 6, 2016

Hello,

before some time I've been fixing a bug in our project which was caused by using setValue on input instead of setDefaultValue, so typed value by user was overwritten. After investigation I've found same bug across our projects and made by a lot of different developers.
This moved me to think about setValue method which is confusing. Is there any use-case, when it can't be protected? I think, that it's only used in creating custom inputs and then protected or at least @Internal annotation should help with eliminating this mistake. Custom inputs are extending input so protected is ok.
In my opinion is this more confusing, than eg. method callbacks so we should think about it.

@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Apr 1, 2016

setValue() cannot be protected, because is called from Container, Rules and Validator.

dg added a commit to dg/nette-forms that referenced this issue Jun 30, 2016
dg added a commit to dg/nette-forms that referenced this issue Jun 30, 2016
@dg dg closed this in 42a8f01 Jun 30, 2016
dg added a commit to dg/nette-forms that referenced this issue Jun 30, 2016
dg added a commit to dg/nette-forms that referenced this issue Jan 16, 2017
dg added a commit to dg/nette-forms that referenced this issue Jun 19, 2017
dg added a commit to dg/nette-forms that referenced this issue Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.