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

[5.1] Add onchange option to modal-select form field #43618

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Jun 5, 2024

Summary of Changes

I noticed that the layout of the modal-select form field declares the $onchange option, but does not use it. This PR fixes that. I'm not sure if this is a new feature or a bugfix, since it fixes a broken behavior, but could also be judged as a new feature? I created it for 5.1 for now.

Testing Instructions

Edit a filter form like administrator/components/com_content/forms/filter_articles.xml and add a modal select field here. One example would be the following:

			<field
				name="test"
				type="article"
				label="COM_CONTENT_FIELD_SELECT_ARTICLE_LABEL"
				required="true"
				select="true"
				new="true"
				edit="true"
				clear="true"
				onchange="this.form.submit();"
			/>

(You have to add addfieldprefix="Joomla\Component\Content\Administrator\Field" to the <fieldset> of that XML, too.)

Go to the article list view in the backend and select an article from the modal.

Actual result BEFORE applying this Pull Request

Article is selected, nothing happens otherwise.

Expected result AFTER applying this Pull Request

Article is selected, the filter form is submitted and the page is reloading. (Since there is no filter for this on the server side, the request doesn't change anything, but the onchange event is properly fired.)

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@HLeithner
Copy link
Member

We should not use inline javascript anymore

@Hackwar
Copy link
Member Author

Hackwar commented Jun 5, 2024

Sure, but as long as we have this option everywhere else, we should also keep it consistent.

@HLeithner
Copy link
Member

I have tested this item ✅ successfully on 992cc09


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43618.

1 similar comment
@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 992cc09


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43618.

@Quy Quy added the NPM Resource Changed This Pull Request can't be tested by Patchtester label Jun 18, 2024
@Quy
Copy link
Contributor

Quy commented Jun 18, 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43618.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 18, 2024
@Quy Quy added the bug label Jun 18, 2024
@joomla-cms-bot joomla-cms-bot removed the NPM Resource Changed This Pull Request can't be tested by Patchtester label Jun 18, 2024
@bembelimen bembelimen merged commit 3bcaab9 into joomla:5.1-dev Jul 3, 2024
0 of 2 checks passed
@bembelimen
Copy link
Contributor

Thanks.

@Hackwar could you do a PR to deprecate all this inline stuff and think about a proper implementation?

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jul 3, 2024
@bembelimen bembelimen added this to the Joomla! 5.1.2 milestone Jul 3, 2024
brbrbr pushed a commit to brbrbr/joomla-cms that referenced this pull request Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants