-
Notifications
You must be signed in to change notification settings - Fork 1
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
FormElement: Add RadioElement
#68
Conversation
fffa282
to
9a40958
Compare
ea466be
to
e08c13e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the requested changes please
- use heredoc for the expected HTML and
- replace validation with something like an
InArray
validator provided inaddDefaultValidators()
.
This will not help much, since we also need to check for the |
The value should be validated against a list of possible values. Possible values are all options that are not disabled. |
Please don't resolve conversations just for fun. I don't see anything resolved in the code. |
96be016
to
6376262
Compare
307eaa9
to
7fa1a50
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be InArrayValidator
and not InArray
, right?
I think it is best to have an option to defer which values to validate against in the InArrayValidator
, by passing a callback to retrieve the possible values.
Maybe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tests:
testSetOptionsResetsOptions()
testOrderOfOptionsAndDisabledOptionsDoesNotMatter()
testGetOptionReturnsPreviouslySetOption()
-
public function testNullAndTheEmptyStringAreAlsoEquallyHandledWhileDisablingOptions() { $radio = new RadioElement('radio'); $radio->setOptions([null => 'Foo', 'bar' => 'Bar']); $radio->setDisabledOptions([null]); $this->assertTrue($radio->getOption(null)->isDisabled()); $radio = new RadioElement('radio'); $radio->setOptions(['' => 'Foo', 'bar' => 'Bar']); $radio->setDisabledOptions(['']); $this->assertTrue($radio->getOption('')->isDisabled()); $radio = new RadioElement('radio'); $radio->setOptions([null => 'Foo', 'bar' => 'Bar']); $radio->setDisabledOptions(['']); $this->assertTrue($radio->getOption(null)->isDisabled()); $radio = new RadioElement('radio'); $radio->setOptions(['' => 'Foo', 'bar' => 'Bar']); $radio->setDisabledOptions([null]); $this->assertTrue($radio->getOption('')->isDisabled()); }
-
public function testGetOptionGetValueAndElementGetValueHandleNullAndTheEmptyStringEqually() { $radio = new RadioElement('radio'); $radio->setOptions(['' => 'Foo']); $radio->setValue(''); $this->assertNull($radio->getValue()); $this->assertNull($radio->getOption('')->getValue()); $radio = new RadioElement('radio'); $radio->setOptions([null => 'Foo']); $this->assertNull($radio->getValue()); $this->assertNull($radio->getOption(null)->getValue()); }
a866480
to
bc71c72
Compare
bc71c72
to
3e5e8b2
Compare
410151f
to
b37b91d
Compare
b37b91d
to
d20993c
Compare
d20993c
to
3bdc1af
Compare
4f55e2e
to
9d24ce5
Compare
9d24ce5
to
0d0f388
Compare
Please add an option to render the input fields without wrapping them into the |
Can you explain the use case please? |
I have a very special use case though that would stretch the scope to explain here but in short, I don't want the inputs to be wrapped in a label that I can neither access it with |
Blocked by
DeferredInArrayValidator
ipl-validator#12