1. peacetree
  2. Support
  3. Monday, May 13 2019, 09:18 AM
In a previous post I wanted to show fields in a custom module in case there is a value.
You adviced me how to do this with css (ones again thanks for that).

From the documentation I figure I can only show field values.
Is there a way to display also the title of the field in case there is a value?
Accepted Answer
admin Accepted Answer
Admin
Hi,
unfortunately this is not possible natively but there are a couple of workarounds:
1) Uses HTML delimiter field type to show field (name+value)
- Create a HTML field type with text like this:
Gender: {user gender displayed}

- Set condition on "Gender" field type like: if equal to custom value (leave empty) hide Gender delimiter field
- Now you can choose to show the delimiter field in your list, the HTML delimiter contain also fieldname and it will be displayed only when Gender is not empty.

2) You can use some free plugin like Sourcerer (https://www.regularlabs.com/extensions/sourcerer) to get show in a HTML Delimiter field type a PHP code, for example you can put a code like this:
{source}
<?php
global $JSNLIST_DISPLAYED_ID;
if($JSNLIST_DISPLAYED_ID) $owner_id=$JSNLIST_DISPLAYED_ID;
else $owner_id=JRequest::getVar( 'id' , JFactory::getUser()->id );
$value = JsnHelper::getUser($owner_id)->getField('gender');
if($value) echo 'Gender: ' . $value;
?>
{/source}
  1. more than a month ago
  2. Support
  3. # Permalink


There are no replies made for this post yet.
However, you are not allowed to reply to this post.