-
Notifications
You must be signed in to change notification settings - Fork 106
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
Improve form JS init selector #2049
Conversation
d78d010
to
5e7b105
Compare
733e8ac
to
5b181e7
Compare
e303679
to
d7342c2
Compare
if ($this->buttonSave) { | ||
$this->buttonSave = $this->layout->addButton($this->buttonSave); | ||
$this->buttonSave->setAttr('tabindex', 0); | ||
$jsSubmit = $this->js()->form('submit'); |
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.
Invoke div.ui.form
submit
, thanks to l138, the submit will be sent to the native form tag.
@@ -135,9 +135,8 @@ protected function init(): void | |||
parent::init(); | |||
|
|||
$this->formElement = View::addTo($this, ['element' => 'form', 'shortName' => 'form'], ['FormElementOnly']); | |||
$this->on('submit', new JsExpression('if (event.target === this) { []; }', [$this->formElement->js()->trigger('submit')])); |
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.
This is the main point of this PR, dispatch native event without instantiating Fomantic-UI form behaviour for the native form tag.
eb04a59
to
84def7b
Compare
84def7b
to
a1d86a6
Compare
related with #1275 and fomantic/Fomantic-UI#2792