- Posts: 22
- Thank you received: 0
[SOLVED] Extra field only visible when there are 2 in group
- lcp298
- Topic Author
- Offline
- Junior Member
-
Less
More
11 years 8 months ago #1597
by lcp298
Extra field only visible when there are 2 in group was created by lcp298
I have a few groups, and they are all visible on the item page, except for the one group that only has 1 extra field in it.
When I added another extra field to that group, they both appear, BUT both fields have to have content, If one of them is empty neither of them appears
.
I have even recreated the extra fields from scratch but it still happens this way.
When I added another extra field to that group, they both appear, BUT both fields have to have content, If one of them is empty neither of them appears
.
I have even recreated the extra fields from scratch but it still happens this way.
Please Log in or Create an account to join the conversation.
- lcp298
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 0
11 years 8 months ago #1598
by lcp298
Replied by lcp298 on topic Extra field only visible when there are 2 in group
Just realised I put this in the wrong place, but I can't move it.
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
11 years 8 months ago #1600
by mmmaug1977
Replied by mmmaug1977 on topic Extra field only visible when there are 2 in group
Hi,
Most probably there is something wrong in the code which used to display the extra fields, MEFG mainly works on the item form.
Can you copy & paste here the code that you are using to display the extra fields?
Most probably there is something wrong in the code which used to display the extra fields, MEFG mainly works on the item form.
Can you copy & paste here the code that you are using to display the extra fields?
Please Log in or Create an account to join the conversation.
- lcp298
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 0
11 years 8 months ago #1602
by lcp298
Replied by lcp298 on topic Extra field only visible when there are 2 in group
This is the original code from the item.php file, I haven't changed anything inside except to take it out of a list format.
Code:
<!-------------------- Item extra fields ------------------------->
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<div class="itemExtraFields">
<?php
$extraFieldsByGroup = JArrayHelper::pivot($this->item->extra_fields, 'group');
$db = JFactory::getDbo();
$query = "SELECT * FROM #__k2_extra_fields_groups";
$db->setQuery($query);
$groups = $db->loadAssocList('id');
foreach ($extraFieldsByGroup as $key=>$extrafields){
$defaultGroup = '';
if($key == $this->item->category->extraFieldsGroup)
$defaultGroup = "class='mefg_default'";
?>
<div id="group" class="<?php echo $groups[$key]['name'];?>" >
<table class="<?php echo $groups[$key]['name'];?>">
<tr><td colspan="2"><h3><?php echo JText::_($groups[$key]['name']); ?></h3></td></tr>
<!--<ul>-->
<?php foreach ($extrafields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<?php /*?><li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"><?php */?>
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<tr>
<td class="name" valign="top"><span class="itemExtraFieldsLabel"><?php echo JText::_($extraField->name); ?>:</span></td>
<td class="value"><span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span></td></tr>
<?php endif; ?>
<!--</li>-->
<?php endif; ?>
<?php endforeach; ?>
<!--</ul>-->
</table></div>
<?php
}
?>
<div class="clr"></div>
</div>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
11 years 8 months ago #1605
by mmmaug1977
Replied by mmmaug1977 on topic Extra field only visible when there are 2 in group
This is very odd!
As I can see, nothing is wrong with the code.
Maybe it is a cache problem?
As I can see, nothing is wrong with the code.
Maybe it is a cache problem?
Please Log in or Create an account to join the conversation.
- lcp298
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 0
11 years 8 months ago #1606
by lcp298
Replied by lcp298 on topic Extra field only visible when there are 2 in group
I have had cache issues with Firefox before, but I have also tried it in other browsers, one of which has never opened the site before.
I don't know of any other caches.
I don't know of any other caches.
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
11 years 8 months ago #1609
by mmmaug1977
Replied by mmmaug1977 on topic Extra field only visible when there are 2 in group
Some templates have cache settings, and maybe Joomla cache also.
Please Log in or Create an account to join the conversation.
- lcp298
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 0
11 years 8 months ago #1610
by lcp298
Replied by lcp298 on topic Extra field only visible when there are 2 in group
There were no cache files for the template, but I cleared all that were there anyway. I'm sure this wasn't a problem in the old version.
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
11 years 8 months ago #1611
by mmmaug1977
Replied by mmmaug1977 on topic Extra field only visible when there are 2 in group
This is very odd!
I will try to simulate it on my side, but let me know what type of fields are used?
I think they are text area fields, right?
I will try to simulate it on my side, but let me know what type of fields are used?
I think they are text area fields, right?
Please Log in or Create an account to join the conversation.
- lcp298
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 0
11 years 8 months ago #1612
by lcp298
Replied by lcp298 on topic Extra field only visible when there are 2 in group
Yes, they are textarea fields.I also have one (which I actually didn't want visible so had hidden in css) which doesn't appear either, and that's a text field.
Please Log in or Create an account to join the conversation.