joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

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

Open Hackwar opened this issue 1 year ago • 5 comments

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:

  • [X] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [X] No documentation changes for manual.joomla.org needed

Hackwar avatar Jun 05 '24 09:06 Hackwar

We should not use inline javascript anymore

HLeithner avatar Jun 05 '24 09:06 HLeithner

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

Hackwar avatar Jun 05 '24 10:06 Hackwar

I have tested this item :white_check_mark: successfully on 992cc09e24e1e419808c8d6991a45a2f6c4c28b3


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

HLeithner avatar Jun 13 '24 07:06 HLeithner

I have tested this item :white_check_mark: successfully on 992cc09e24e1e419808c8d6991a45a2f6c4c28b3


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

viocassel avatar Jun 18 '24 18:06 viocassel

RTC


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

Quy avatar Jun 18 '24 19:06 Quy

Thanks.

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

bembelimen avatar Jul 03 '24 13:07 bembelimen