- Posts: 2
COMMUNITY FORUM
Bug in Item field type
- Artur Stępień
- Topic Author
- Offline
- New Member
Less
More
8 years 7 months ago #151286
by Artur Stępień
Bug in Item field type was created by Artur Stępień
Hello. I didn't found a proper place where to report bug so I do it here. There is a bug in Item field type of K2 located in. When there are two or more fields of this type in the same page the selected article is chosen only in the last one no matter if you click the Select button near first of second field.
Screen (look at what button I do click):
/administrator/components/com_k2/elements/item.php
Screen (look at what button I do click):
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 7 months ago #151288
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Bug in Item field type
Hello,
Is this view a part of Joomla! or a 3rd party extension?
Is this view a part of Joomla! or a 3rd party extension?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Artur Stępień
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
8 years 7 months ago - 8 years 7 months ago #151290
by Artur Stępień
Replied by Artur Stępień on topic Bug in Item field type
This is in module I'm creating. I want to give user a possibility to select articles in 2 fields. The best way would be to use a field with modal window like article_modal from com_content. I found field like this in K2. But it has a bad written JS I think. That's why it allows only one instance of a Item field be used in one view.
Last edit: 8 years 7 months ago by Artur Stępień.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
8 years 7 months ago #151302
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Bug in Item field type
@Artur Stępień
The fact that this field supports only one instance is not considered a bug. It was designed like that according to the needs.
Since you are developing your own module, you have to create a field on your own to handle that.
The fact that this field supports only one instance is not considered a bug. It was designed like that according to the needs.
Since you are developing your own module, you have to create a field on your own to handle that.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Olivier Buisard
- Offline
- New Member
Less
More
- Posts: 6
8 years 2 weeks ago #157742
by Olivier Buisard
Replied by Olivier Buisard on topic Bug in Item field type
Hello,
I am having the same issue.
Creating my own 'item' custom field is easy, but the problem seems to come from the modal view used by the field (the return value is sent to the last field on the page).
It would actually be 'nice' for the K2 team to improve on the modal view in order to allow re-use of the code (like it is done in the Joomla! core for the 'article' custom field).
This is one huge limitation of the K2 'item' custom field in my opinion.
I am having the same issue.
Creating my own 'item' custom field is easy, but the problem seems to come from the modal view used by the field (the return value is sent to the last field on the page).
It would actually be 'nice' for the K2 team to improve on the modal view in order to allow re-use of the code (like it is done in the Joomla! core for the 'article' custom field).
This is one huge limitation of the K2 'item' custom field in my opinion.
Please Log in or Create an account to join the conversation.
- Olivier Buisard
- Offline
- New Member
Less
More
- Posts: 6
8 years 2 weeks ago #157746
by Olivier Buisard
Replied by Olivier Buisard on topic Bug in Item field type
I was able to overcome the 'item' custom field limitations.
For anyone interested in the custom field 'k2item' I have created in replacement for the original one, please contact me here and I will be happy to share :-)
For anyone interested in the custom field 'k2item' I have created in replacement for the original one, please contact me here and I will be happy to share :-)
Please Log in or Create an account to join the conversation.
- Olivier Buisard
- Offline
- New Member
Less
More
- Posts: 6
8 years 2 weeks ago #157747
by Olivier Buisard
Replied by Olivier Buisard on topic Bug in Item field type
Finally: there is an omission in the 'element' view of items.
'object' (which is in the request) is lost when paginating through items (actually, any time there is a refresh in the modal window), resulting in the item selected not being picked up when properly coding an 'item' custom field to allow for multiple occurrences on a page. When there is just one 'item' custom field (original from core K2), the bug gets unnoticed (since 'object' is never used in jSelectItem of the 'item' custom field).
Adding to the form of the view:fixes the issue.
'object' (which is in the request) is lost when paginating through items (actually, any time there is a refresh in the modal window), resulting in the item selected not being picked up when properly coding an 'item' custom field to allow for multiple occurrences on a page. When there is just one 'item' custom field (original from core K2), the bug gets unnoticed (since 'object' is never used in jSelectItem of the 'item' custom field).
Adding to the form of the view:
<input type="hidden" name="object" value="<?php echo JRequest::getCmd('object', 'id'); ?>" />
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 2 weeks ago #157772
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Bug in Item field type
Hello Olivier, and thank you for your contribution.
Can you make a PR at github.com/getk2/k2
Can you make a PR at github.com/getk2/k2
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Olivier Buisard
- Offline
- New Member
Less
More
- Posts: 6
8 years 2 weeks ago #157776
by Olivier Buisard
Replied by Olivier Buisard on topic Bug in Item field type
You are welcome. I just added a PR at github :-)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 2 weeks ago #157779
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Bug in Item field type
Thank you Olivier for your contribution :)
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.