Keyword

Hide extra field if value is empty

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 3 months ago #71150 by Nick
I'm working on a mod that hides an extra field if the value is empty. In my case it's really handy.

I have a database of files with a lot of mirrors. Some files have 3 mirrors some have 5. Therefore i created like 7 link fields. But if i fill only 3 of them, the other 4 still appear but are empty! not good!

I got up to here, but my php seems to break down at this point. A guy over at codingforums is giving me the "right code", i'm just fiddling around with it.

I need some serious php guru's here!
www.codingforums.com/showthread.php?p=854701

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 3 months ago #71151 by Nick
Replied by Nick on topic Hide extra field if value is empty
I can't seem to post scripts here. Check out this forum:
www.codingforums.com/showthread.php?p=854701

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

More
15 years 3 months ago #71152 by Marcel Plomp
Replied by Marcel Plomp on topic Hide extra field if value is empty
it would be nicer to display some text instead of displaying nothing, like this:
"Fieldname:" "-unkown-"

..
But when you found out to hide empty fields, please let us know :)

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 3 months ago #71153 by Nick
Replied by Nick on topic Hide extra field if value is empty
I did it. This ONLY works with fields that have a SINGLE field in them. I only tried it with the textbox extra field. I'm trying to get this to work with the links extra field. It's not working with that one.

To use this, download the paste.txt and open it up. FTP into your server and go to components->com_k2->templates->default->item.php

Go down towards line 250 and fine the part that says
Select the lines starting from the line above <--- item extra fields ---> all the way down to 2 lines above

This should stop from a text box from being visible if it is empty. Now let's try to get this to work with links.
Attachments:

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

More
15 years 3 months ago #71154 by Marcel Plomp
Replied by Marcel Plomp on topic Hide extra field if value is empty
Nice one! gone try it soon :)

Nick Tsutsunava said:I did it. This ONLY works with fields that have a SINGLE field in them. I only tried it with the textbox extra field. I'm trying to get this to work with the links extra field. It's not working with that one.
To use this, download the paste.txt and open it up. FTP into your server and go to components->com_k2->templates->default->item.php

Go down towards line 250 and fine the part that says
Select the lines starting from the line above <--- item extra fields ---> all the way down to 2 lines above

This should stop from a text box from being visible if it is empty. Now let's try to get this to work with links.

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 3 months ago #71155 by Nick
Replied by Nick on topic Hide extra field if value is empty
did it work?

Marcel Plomp said:Nice one! gone try it soon :)
Nick Tsutsunava said:I did it. This ONLY works with fields that have a SINGLE field in them. I only tried it with the textbox extra field. I'm trying to get this to work with the links extra field. It's not working with that one. To use this, download the paste.txt and open it up. FTP into your server and go to components->com_k2->templates->default->item.php

Go down towards line 250 and fine the part that says
Select the lines starting from the line above <--- item extra fields ---> all the way down to 2 lines above

This should stop from a text box from being visible if it is empty. Now let's try to get this to work with links.

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

More
15 years 1 month ago #71156 by Ivan Dorić
Replied by Ivan Dorić on topic Hide extra field if value is empty
Hi,

just wanted to confirm that the code form paste.txt definitely works for text fields and text areas.

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

More
15 years 13 hours ago #71157 by Jiliko.net
Replied by Jiliko.net on topic Hide extra field if value is empty
Hi,

I've posted a solution here.

Olivier Nolbert
www.jiliko.net

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


Powered by Kunena Forum