Skip to content
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

Merged
merged 16 commits into from
May 22, 2023
Merged

Improve form JS init selector #2049

merged 16 commits into from
May 22, 2023

Conversation

mvorisek
Copy link
Member

@mvorisek mvorisek commented May 21, 2023

related with #1275 and fomantic/Fomantic-UI#2792

if ($this->buttonSave) {
$this->buttonSave = $this->layout->addButton($this->buttonSave);
$this->buttonSave->setAttr('tabindex', 0);
$jsSubmit = $this->js()->form('submit');
Copy link
Member Author

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.

@mvorisek mvorisek marked this pull request as ready for review May 22, 2023 07:53
@mvorisek mvorisek changed the title Fix form JS init selector Improve form JS init selector May 22, 2023
@@ -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')]));
Copy link
Member Author

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.

@mvorisek mvorisek merged commit 02da37a into develop May 22, 2023
43 of 44 checks passed
@mvorisek mvorisek deleted the fix_form_init_selector branch May 22, 2023 08:05
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.

None yet

1 participant