Welcome, Guest
Username: Password: Remember me

TOPIC: Is it possible to hide/show a tab based on a field

Is it possible to hide/show a tab based on a field 01 May 2019 19:11 #15732

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 126
  • Thank you received: 4
  • Karma: 1
Does anyone know how to hide or show a field based on the content of a field?

For example if a selection field had cat,dog,fish and there were three hidden tabs called cat,dog,fish. if the user has selected cat. next time the form opens the cat tab will show. or dog or nothing dependent on what was selected...
Basically want this so an initial simple form is completed and when save and closed it will go to a multiple tabbed page for more detail based on the selections in the initial form.

Hope someone can help .. my coding is rubbish and I'm getting to old to do a course.

Regards

Jonathan
The administrator has disabled public write access.

Is it possible to hide/show a tab based on a field 03 May 2019 15:29 #15733

  • Nicolas
  • Nicolas's Avatar
  • Offline
  • Senior Member
  • Posts: 72
  • Thank you received: 11
  • Karma: 5
Hi Jonathanbell

If I understand correctly, the user saves his form and ticks options. Depending on the option he checked, the tabs are visible or not.

Does the display of the tab depend on a table in the database?
Otherwise the user ticks in box and the tab appears directly?

Both are relatively simple. But I need to know which situation releases the display of the tab

Nicolas
The administrator has disabled public write access.

Is it possible to hide/show a tab based on a field 04 May 2019 01:59 #15734

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 126
  • Thank you received: 4
  • Karma: 1
Hi, it would rely on the table. On save the form goes to the next form with more detail / tabs and based on the original setting would then show a tab if selected on the previous page.
The administrator has disabled public write access.

Is it possible to hide/show a tab based on a field 04 May 2019 09:41 #15736

  • Nicolas
  • Nicolas's Avatar
  • Offline
  • Senior Member
  • Posts: 72
  • Thank you received: 11
  • Karma: 5
I don't know how your database is built or how you get the data after sending the form.
I don't know how you know about coding, but try something like this:
<ul class="nav nav-tabs">
	<li class="active" id="chienTab" <?php if ($this->item->chien == 0) { echo style="display:none"; } ?>>
		<a href="#chien" data-toggle="tab">
			<?php echo(JText::_('TAB_CHIEN')); ?>
		</a>
	</li>

	<li class="" id="chatTab" <?php if ($this->item->chat == 0) { echo style="display:none"; } ?>>
		<a href="#chat" data-toggle="tab">
			<?php echo(JText::_('TAB_CHAT')); ?>
		</a>
	</li>
	<li class="active" id="poissonTab" <?php if ($this->item->poisson == 0) { echo style="display:none"; } ?>>
		<a href="#poisson" data-toggle="tab">
			<?php echo(JText::_('TAB_POISSON')); ?>
		</a>
	</li>
</ul>
after modifications according to your component, it should work
If you can not do it, send me the component and I'll make the change in it

Nicolas
Last Edit: 04 May 2019 09:42 by Nicolas. Reason: misstype
The administrator has disabled public write access.
The following user(s) said Thank You: jonathanbell

Is it possible to hide/show a tab based on a field 05 May 2019 01:06 #15737

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 126
  • Thank you received: 4
  • Karma: 1
Thanks, I have a little coding knowledge ( which I suppose is dangerous ). Will give it a crack.
The administrator has disabled public write access.

Is it possible to hide/show a tab based on a field 05 May 2019 07:22 #15738

  • Nicolas
  • Nicolas's Avatar
  • Offline
  • Senior Member
  • Posts: 72
  • Thank you received: 11
  • Karma: 5
:lol: Don't worry. It would be necessary to modify the Joomla core to create a crack.
If you do something dangerous in your component, joomla warns you.

It's a good time to learn how to code a little bit ;)
The administrator has disabled public write access.

Is it possible to hide/show a tab based on a field 10 May 2019 09:22 #15739

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 126
  • Thank you received: 4
  • Karma: 1
:) yeh I know.. Cheers
The administrator has disabled public write access.
Time to create page: 0.059 seconds

Get Started