Multiple list in custom component with style like field Tags in article edit layout Topic is solved

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
zeus07
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Fri Feb 05, 2016 12:25 am

Multiple list in custom component with style like field Tags in article edit layout

Post by zeus07 » Thu Mar 21, 2024 9:57 am

Hi guys!

I created my own component for FAQ several years ago for Joomla 3 and now I'll migrating it to the Joomla 4. I have template edit.php where admin can add new questions.

In this template I displaying multiple list where admin can select one or several articles for each question. The type of this field is SQL, but in admin panel it looks like a list.
Below you can see screenshot:
screen1.png
I want to style this field and do it something like field Tags in article edit template:
screen1.png
This code of this field from XML:

Code: Select all

<field name="id_article"
			   type="sql"
			   label="COM_FAQ_ID_ARTICLE"
			   description="COM_FAQ_ID_ARTICLE_DESCRIPTION"
			   query="SELECT id, concat(title, ' : ( id-',id,' )') AS title FROM #__content"
			   key_field="id"
			   value_field="title"
			   required=""
			   class="faq-width select-multiple choices__input"
			   default=""
			   multiple="multiple"
		/>
Help please, how I can do it?

Thanks!
You do not have the required permissions to view the files attached to this post.

zeus07
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Fri Feb 05, 2016 12:25 am

Re: Multiple list in custom component with style like field Tags in article edit layout

Post by zeus07 » Thu Mar 21, 2024 12:47 pm

I changed XML for this field and now it looks like this:

Code: Select all

<field name="id_article"
			   type="sql"
			   label="COM_FAQ_ID_ARTICLE"
			   description="COM_FAQ_ID_ARTICLE_DESCRIPTION"
			   query="SELECT id, concat(title, ' : ( id-',id,' )') AS title FROM #__content"
			   key_field="id"
			   value_field="title"
			   required=""
			   class="faq-width"
			   default=""
			   multiple="true"
			   layout="joomla.form.field.groupedlist-fancy-select"
		/>
But I see couple errors:
screen3.png
Help please to fix this errors
You do not have the required permissions to view the files attached to this post.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 31030
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Multiple list in custom component with style like field Tags in article edit layout

Post by Per Yngve Berg » Thu Mar 21, 2024 1:33 pm

Mod. Note: Relocated topic from the extensions forum to the Coding Forum.

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2954
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Multiple list in custom component with style like field Tags in article edit layout

Post by SharkyKZ » Thu Mar 21, 2024 3:36 pm

Try "joomla.form.field.list-fancy-select" instead of "joomla.form.field.groupedlist-fancy-select".

zeus07
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Fri Feb 05, 2016 12:25 am

Re: Multiple list in custom component with style like field Tags in article edit layout

Post by zeus07 » Thu Mar 21, 2024 3:43 pm

SharkyKZ wrote:
Thu Mar 21, 2024 3:36 pm
Try "joomla.form.field.list-fancy-select" instead of "joomla.form.field.groupedlist-fancy-select".
Thanks! It helps me!


Post Reply

Return to “Joomla! 4.x Coding”