Welcome, Guest
Username: Password: Remember me

TOPIC: Hide if empty

Hide if empty 03 Jan 2017 17:28 #14898

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
Can we have an option for a field in a fly view

'Hide if Empty' (or set this as a component wide default setting which can be overridden at the field level)

and as an expansion, add to a fly brick

'Hide if all fields are empty'

Thanks
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Hide if empty 03 Jan 2017 20:18 #14900

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
For now, fields in an exploded view you can test $field->value:
	<?php
	// kids
	$field = $fieldSet['jform_count'];
	if (($field->value > 0)) :
	?>
	<div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>">
		<div class="control-label">
			<?php echo $field->label; ?>
		</div>

		<div class="controls">
			<?php echo $field->input; ?>
		</div>
	</div>
	<?php endif ?>
My only question is; how will you ever load them if they are initially hidden?
:unsure:
The administrator has disabled public write access.

Hide if empty 03 Jan 2017 20:20 #14901

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
Sorry this was just a new functionality request, I know a few work arounds but its just boring coding them

Example of why this would help save me time

I have 'optional' fields in an item meta that do not need to be filled out, there are about 30 in total. Thats 30 times I need to wrap a field in an if statement.. whereas a nice tick in a box means its done and dusted and I dont need to FORK / alter
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.
Time to create page: 0.057 seconds

Get Started