-
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 Multiselect element #65
Conversation
5fb3558
to
c51f7cb
Compare
23e1f3b
to
ca695ed
Compare
7dd0883
to
41d50de
Compare
1d04828
to
2e45745
Compare
d520fbf
to
cc22abe
Compare
04340e1
to
b21a796
Compare
b21a796
to
58846c9
Compare
134831c
to
6165b61
Compare
6165b61
to
b3ae3d7
Compare
b3ae3d7
to
9a2d691
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.
Please use nowdoc for expected HTML.
} | ||
} | ||
|
||
BaseFormElement::validate(); |
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.
Why not parent
?
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.
Because the parent class checks its own value first, since I already have a loop above for this check, I skip calling the parent method.
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.
Exactly. In addition we have duplicated code. This shows that the code flow is flawed, and it raises the question of why we even have a separate element for this. Instead, specifying the multiple attribute for the select element should just work.
$this->valid = false; | ||
} else { | ||
parent::validate(); | ||
$this->addMessage(sprintf($this->translate("'%s' is not allowed here"), $value)); |
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.
Possible candidate for InArrayValidator
or DeferredInArrayValidator
.
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.
I have already created a new PR for this.
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.
But I don't see its usage here.
} | ||
} | ||
|
||
BaseFormElement::validate(); |
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.
Exactly. In addition we have duplicated code. This shows that the code flow is flawed, and it raises the question of why we even have a separate element for this. Instead, specifying the multiple attribute for the select element should just work.
* Add multiple attribute in `$defaultAttrributes` and remove constructor * Don't validate in `setValue()`, the `validate()` method is resposible for this.
Form::validate() takes care of this.
9a2d691
to
47ab4d5
Compare
Add |
No description provided.