Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Hide if empty 03 Jan 2017 17:28 #14898

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
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

Please Log in or Create an account to join the conversation.

Hide if empty 03 Jan 2017 20:18 #14900

  • vlemos
  • vlemos's Avatar
  • Away
  • Elite Member
  • Elite Member
  • Posts: 295
  • Thank you received: 41
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:

Please Log in or Create an account to join the conversation.

Hide if empty 03 Jan 2017 20:20 #14901

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
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

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.060 seconds

I must say that I'm leaps and bounds ahead of where I would have other been with J2.5 with full thanks to the folks on this forum and specifically to Cook so you'll never hear me complaining.
gdpodesta (Forum)  

Get Started