- Posts: 6
COMMUNITY FORUM
Extra Field list order
- Bobby
- Topic Author
- Offline
- New Member
I have recently been handed an existing site that is running ver 2.6.x of K2 and I need some assistance.
There is an 'authors' extra field with names entered in the Extra Fields Administrator as below..
John Smith (ID 1)
Susan Jones (ID 2)
Brad Helms (ID 3)
When I go to add a K2 Item, the extra field multi-select for authors is now in alphabetical order (which is helpful) and allows me to select multiple authors in any order one at a time. But, when the item is saved, the author ids are inserted into the database in order of their alphabetical listing ({3,1,2}), not the order in which they were selected. I need them to stay in the order that they are selected. If I select Susan Jones, then Brad Helms, it should be saved as {2,3}.
Thank you in advance for any assistance you can offer.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
Unfortunately this is not possible. This it the default behaviour of the multiple select element.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Bobby
- Topic Author
- Offline
- New Member
- Posts: 6
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
There are extensions in the JED which register new extrafields, maybe you can find something useful in the JED.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Bobby
- Topic Author
- Offline
- New Member
- Posts: 6
Again, thank you for your assistance Krikor.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
What type is that extrafield?
Also, have you modified your templates, can you share some code if you did?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Bobby
- Topic Author
- Offline
- New Member
- Posts: 6
I am getting into this part way through someone else modifying the templates, so I honestly have no idea what they may have done prior.
The com_k2 > templates > default > item.php in my theme doesn't appear to be excluded anything, but when I do
foreach ($this->item->extra_fields as $key=>$extraField)
{
echo $extraField->id;
}
My newly added extrafield is not in the list. It's odd, it is like the IDs of the existing extrafields where hard coded into the query and that's preventing any new ones from getting through. Is that possible?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
My newly added extrafield is not in the list. It's odd, it is like the IDs of the existing extrafields where hard coded into the query and that's preventing any new ones from getting through. Is that possible?
Not really, unless the field does not hold a value, can you check the db to make sure that the field is not empty?
Btw you should use overrides:
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Bobby
- Topic Author
- Offline
- New Member
- Posts: 6
Thanks for the info about the sub templates....I will have a look.
Please Log in or Create an account to join the conversation.
- Bobby
- Topic Author
- Offline
- New Member
- Posts: 6
Please Log in or Create an account to join the conversation.