Q: How to display a select box (type: list) in a Joomla XML file to meet Joomla 5 standards?

Moderator: mindphp

Raja Pdl
PHP VIP Members
PHP VIP Members
โพสต์: 2241
ลงทะเบียนเมื่อ: 27/05/2024 9:50 am

Q: How to display a select box (type: list) in a Joomla XML file to meet Joomla 5 standards?

โพสต์ที่ยังไม่ได้อ่าน โดย Raja Pdl »

In Joomla 5, within a custom component, a type list (select box in an XML file) is not displaying according to Joomla 5 standards. Instead, it appears as a simple HTML select box. How can I fix this to make it display as a Joomla 5 standards select box?

โค้ด: เลือกทั้งหมด

<field 
                name="published" 
                 type="list" 
                 label="JSTATUS" 
                 default="1">
                 <option value="1">JPUBLISHED</option>
                 <option value="0">JUNPUBLISHED</option>
</field>

Actual result
actual res.PNG
actual res.PNG (1.42 KiB) Viewed 300 times

Expected Result
selct expected.PNG
selct expected.PNG (1.35 KiB) Viewed 300 times
ภาพประจำตัวสมาชิก
tsukasaz
PHP VIP Members
PHP VIP Members
โพสต์: 23574
ลงทะเบียนเมื่อ: 18/04/2012 9:39 am

Re: Q: How to display a select box (type: list) in a Joomla XML file to meet Joomla 5 standards?

โพสต์ที่ยังไม่ได้อ่าน โดย tsukasaz »

The problem is caused by the JS of Chosen. You need to remove this line.

โค้ด: เลือกทั้งหมด

JHtml::_('formbehavior.chosen', 'select');
The last bug isn't fixed until the last user is dead. (Sidney Markowitz, 1995)
Raja Pdl
PHP VIP Members
PHP VIP Members
โพสต์: 2241
ลงทะเบียนเมื่อ: 27/05/2024 9:50 am

Re: Q: How to display a select box (type: list) in a Joomla XML file to meet Joomla 5 standards?

โพสต์ที่ยังไม่ได้อ่าน โดย Raja Pdl »

tsukasaz เขียน: 27/12/2024 11:34 am The problem is caused by the JS of Chosen. You need to remove this line.

โค้ด: เลือกทั้งหมด

JHtml::_('formbehavior.chosen', 'select');
Your solution works. Thank you very much.
ตอบกลับโพส

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 2