ChoiceControl: added option to ignore values out of range#28
Closed
japlavaren wants to merge 1 commit intonette:masterfrom
japlavaren:selectbox-validate-values
Closed
ChoiceControl: added option to ignore values out of range#28japlavaren wants to merge 1 commit intonette:masterfrom japlavaren:selectbox-validate-values
japlavaren wants to merge 1 commit intonette:masterfrom
japlavaren:selectbox-validate-values
Conversation
Contributor
|
👎 There is getRawValue for that. |
Author
|
My pull is for other sutuation: I have Select box with items and call Form::setDefaults(). If default value is out of range, http://api.nette.org/2.2.2/source-Forms.Controls.ChoiceControl.php.html#61 throw Invalid argument exception. So I can not use Form::setDefaults() when I want ignore values out of range. I must get controls of form, get items and filter default values by items. This is lot of code that I must duplicate. This pull should do it easily. |
Member
|
It should se value to NULL, when it is out of range. And name setValidateRange is not good, because argument is bool, not range. |
Author
|
Some idea how to name this property? I will change code to set null when is out of range. |
75b0565 to
72a5c56
Compare
164ee7d to
7b7189f
Compare
131f7d2 to
532059a
Compare
a57a557 to
55d0eb8
Compare
dg
added a commit
that referenced
this pull request
Jul 12, 2015
dg
added a commit
that referenced
this pull request
Jul 12, 2015
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added option for ignoring values out of range items.
There is not easy to catch InvalidArgumentException throwed by ChoiceControl::setValue() when control is filled by Form::setValues(). You must handle it by yourself breake DRY.