Skip to content

New Feature: Allows custom group for showon#18937

Merged
mbabker merged 4 commits intojoomla:3.9-devfrom
mvanvu:staging
Jul 21, 2018
Merged

New Feature: Allows custom group for showon#18937
mbabker merged 4 commits intojoomla:3.9-devfrom
mvanvu:staging

Conversation

@mvanvu
Copy link
Copy Markdown
Contributor

@mvanvu mvanvu commented Dec 1, 2017

Pull Request for Issue # .

Summary of Changes

By default the showon feature detects the group from base fields. This PR comes to build for developer can specify the field which from the other group.

Testing Instructions

Eg. I want to show the article title when the value of field jform[attribs][show_title] is show.

Before PR: no way to do (maybe, not sure)

After PR: Article title only show when the show title options is show.

Change the file /administrator/components/com_content/models/forms/article.xml line 21
From

<field 
			name="title" 
			type="text" 
			label="JGLOBAL_TITLE"
			description="JFIELD_TITLE_DESC"
			class="input-xxlarge input-large-text"
			size="40"
			required="true" 
		/>

To

<field 
			name="title" 
			type="text" 
			label="JGLOBAL_TITLE"
			description="JFIELD_TITLE_DESC"
			class="input-xxlarge input-large-text"
			size="40"
			required="true" 
                        showon="attribs.show_title:1"
		/>

The key changing here is showon="attribs.show_title:1".
The custom group should only apply for the first time, for Eg: we need to expand the condition to show_title is empty OR show_title = 1.

`showon="attribs.show_title:[OR]show_title:1"
screenshot from 2017-12-01 22-49-26
screenshot from 2017-12-01 22-49-56

`

@GeraintEdwards
Copy link
Copy Markdown
Contributor

GeraintEdwards commented Dec 3, 2017

I have tested this item ✅ successfully on 66dcdb2

This works fine - a logical extension of showon. I have been grappling with an issue like this for subforms so the idea could be quite useful

By the way you could use

showon="attribs.show_title:1,"

Instead of the more confusing version you have. It basically allows blank or 1 values to match


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

@mvanvu
Copy link
Copy Markdown
Contributor Author

mvanvu commented Dec 5, 2017

Now the show on group is improved overall.
For eg: content title showon attribs.show_title:1[OR]images.float_intro:left

}
else
{
$showOnParts = explode('.', $showOnPartBlocks[0]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are setting $showOnParts but this is an array your are running through at line 472 so this is not a good idea.

You should use a different variable name here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review. This is my fault.

@ghost
Copy link
Copy Markdown

ghost commented Dec 9, 2017

I have tested this item ✅ successfully on 5a5eb72

Test as decribed in first Comment.


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

@ghost
Copy link
Copy Markdown

ghost commented Dec 9, 2017

@GeraintEdwards can you please retest?

@mvanvu
Copy link
Copy Markdown
Contributor Author

mvanvu commented Jan 26, 2018

@franz-wohlkoenig If there is not any problem I think it should be RTC.

@ghost
Copy link
Copy Markdown

ghost commented Jan 26, 2018

@mvanvu i can't decide as there is only one successfully Test, Release Lead can. So best is to get a second Test.

@grhcj
Copy link
Copy Markdown

grhcj commented Jan 26, 2018

I have not tested this item.

Du you expect the title field to be bigger than the alias field?


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

@infograf768 infograf768 changed the title Allows custom group for showon New Feature: Allows custom group for showon Jan 30, 2018
@infograf768
Copy link
Copy Markdown
Member

Changed PR title to New Feature

@coolcat-creations
Copy link
Copy Markdown
Contributor

What is missing here for me is that this showon should also consider the global value. I have Global (Show) but the Alias is not shown.


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

@mvanvu
Copy link
Copy Markdown
Contributor Author

mvanvu commented Jul 17, 2018

@coolcat-creations as suggested from @GeraintEdwards just like this showon="attribs.show_title:1,"

@coolcat-creations
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 5a5eb72


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

@coolcat-creations
Copy link
Copy Markdown
Contributor

Right, sorry - was not obvious to me that it reffered to global :)

@ghost
Copy link
Copy Markdown

ghost commented Jul 17, 2018

Ready to Commit after two successful tests.

@joomla-cms-bot joomla-cms-bot added RTC This Pull Request is Ready To Commit and removed RTC This Pull Request is Ready To Commit labels Jul 17, 2018
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.

7 participants