ChoiceControl: added option to ignore values out of range#28
Conversation
|
👎 There is getRawValue for that. |
|
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. |
|
It should se value to NULL, when it is out of range. And name setValidateRange is not good, because argument is bool, not range. |
|
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
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.