Skip to content

Conversation

@japlavaren
Copy link

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.

@fprochazka
Copy link
Contributor

👎 There is getRawValue for that.

@japlavaren
Copy link
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.

@dg
Copy link
Member

dg commented Jul 14, 2014

It should se value to NULL, when it is out of range. And name setValidateRange is not good, because argument is bool, not range.

@japlavaren
Copy link
Author

Some idea how to name this property? I will change code to set null when is out of range.

@dg dg force-pushed the master branch 6 times, most recently from 75b0565 to 72a5c56 Compare February 8, 2015 13:00
@dg dg added this to the v2.4 milestone Feb 16, 2015
@dg dg force-pushed the master branch 4 times, most recently from 164ee7d to 7b7189f Compare February 18, 2015 11:04
@dg dg force-pushed the master branch 2 times, most recently from 131f7d2 to 532059a Compare May 21, 2015 11:49
@dg dg force-pushed the master branch 2 times, most recently from a57a557 to 55d0eb8 Compare June 19, 2015 12:05
@dg dg closed this in fa966a6 Jul 12, 2015
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

Successfully merging this pull request may close these issues.

3 participants