Keyword

Hide extra field if value is empty

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 8 months ago #71694 by Nick
It would be great if an empty field would be hidden if it's value output is empty. I coded something myself which hides an extra field if the value is empty but it only seems to work with single box fields (text box) as it has only 1 value. Links for example have 3 values and will not hide for a retarded reason. Could JoomlaWorks send me a code snippet that would hide ANY extra field if the value output echoe's as empty. I can't seem to figure it out...
I keep pushing this for the 3rd time. Not because i'm an asshole, but because Joomlaworks doesn't even reply to 90% of the posts in their forums. Now that is just stupid.

I believe that this will make extra fields SO MUCH more usefull, and it gets rid of the group's. I hate them.

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 8 months ago #71695 by Nick
Replied by Nick on topic Hide extra field if value is empty
BUMPING THIS. WHERE ARE THE DEVS?

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

  • Anthony Antonellis
  • Anthony Antonellis's Avatar
  • Offline
  • Junior Member
More
15 years 7 months ago #71696 by Anthony Antonellis
Replied by Anthony Antonellis on topic Hide extra field if value is empty
i managed to hide the empty fields, it took a little reworking of the css and the template but its definitely doable. it works in everything so far, except the beloved ie6.

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 7 months ago #71697 by Nick
Replied by Nick on topic Hide extra field if value is empty
omfg how did you do that!!!! omfg omfg omfg please tell me! This way i might be able to perfect it with some php and make it work in ie6 :O

Anthony Antonellis said:i managed to hide the empty fields, it took a little reworking of the css and the template but its definitely doable. it works in everything so far, except the beloved ie6.

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

  • Francisco Ferreira
  • Francisco Ferreira's Avatar
  • Offline
  • Junior Member
More
15 years 6 months ago #71698 by Francisco Ferreira
Replied by Francisco Ferreira on topic Hide extra field if value is empty
Hi Anthony,

Can you share your solution with us?

Many thanks in advance,

Francis

Anthony Antonellis said:i managed to hide the empty fields, it took a little reworking of the css and the template but its definitely doable. it works in everything so far, except the beloved ie6.

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

More
15 years 6 months ago #71699 by Jiliko.net
Replied by Jiliko.net on topic Hide extra field if value is empty
Hi everyone,

here's my solution to hide the fields with empty value :

I've added some code to the div that displays ExtraFields in my own item.php k2 template file.
Here's the code of my div...

Hope it will help...
Attachments:

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
15 years 6 months ago #71700 by Nick
Replied by Nick on topic Hide extra field if value is empty
Bravo... that's all i can say. It fucking worked.

Here are some issues tho, not a problem but just pointing it out.

The field ONLY disappears when the link area contains http:// that's the only case. It even disappears when the description area has text in it. If the link part contains http:// the field will disappear, no matter what. It's cool tho! Thanks a lot!

I think i just jizzed in my pants.

Olivier Nolbert said:Hi everyone,
here's my solution to hide the fields with empty value :

I've added some code to the div that displays ExtraFields in my own item.php k2 template file.
Here's the code of my div...

Hope it will help...

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

  • Francisco Ferreira
  • Francisco Ferreira's Avatar
  • Offline
  • Junior Member
More
15 years 6 months ago #71701 by Francisco Ferreira
Replied by Francisco Ferreira on topic Hide extra field if value is empty
It Works!!!!! It works!!!! Alleluia, praise the lord ;-)...

You just saved my life man!!!

Many thanks for a great job!!!

Olivier Nolbert said:Hi everyone,
here's my solution to hide the fields with empty value :

I've added some code to the div that displays ExtraFields in my own item.php k2 template file.
Here's the code of my div...

Hope it will help...

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

More
15 years 3 months ago #71702 by Jason Noel
Replied by Jason Noel on topic Hide extra field if value is empty
Wow... Thanks a lot!!!! This works perfectly!

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

More
15 years 1 month ago #71703 by Cheche
Replied by Cheche on topic Hide extra field if value is empty
Nolbert,

Thank you so much for providing this code. Well thought out solution and works just like it should. You saved me from having to program my own solution and I can't thank you enough.

This should definitely be added to the K2 core.

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

More
15 years 1 month ago #71704 by strummsteel
Replied by strummsteel on topic Hide extra field if value is empty
Actually, since we can use the extra field as another way of organizing content.

You can use the the excellent k2 plugin here to filer your extra fields content: community.getk2.org/forum/topics/k2-extra-fields-filter-and

Is there a way for us to actually hide, extra fields even when they are not empty?

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

More
15 years 1 month ago #71705 by troponin
Replied by troponin on topic Hide extra field if value is empty
just deselect options "Show Extra Fields" in the Cat in Backend

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

More
15 years 1 month ago #71706 by strummsteel
Replied by strummsteel on topic Hide extra field if value is empty
Hey thanks for the info, but i meant, hide items within the extra fields. Currently its all or nothing, is there a way to show or hide them selectively?

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

More
15 years 1 month ago #71707 by strummsteel
Replied by strummsteel on topic Hide extra field if value is empty
Devs? update please?

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

More
15 years 1 month ago #71708 by Geoffww
Replied by Geoffww on topic Hide extra field if value is empty
My workaround is to not use Extra Fields but use their classes and make my own lists in the Content section.
This forum doesn't support
>:|

{div class="itemExtraFields"}
{h3}Additional Info{/h3}
{ul}
{li class="even typeTextfield group2"}
{span class="itemExtraFieldsLabel"} Label: {/span}
{span class="itemExtraFieldsValue"} Value{/span},{br class="clr"/},{/li}
{li class="odd typeTextfield group2"},{span class="itemExtraFieldsLabel"}Width:{/span} {span},{/span},{br class="clr"/},{/li}
{/ul}
{/div}
If you don't like something about their output edit the K2.css fill for that class.

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

More
15 years 1 month ago #71709 by Geoffww
Replied by Geoffww on topic Hide extra field if value is empty
Implementing Olivier Nolbert's code causes Odd and Even rows to be out of sync.

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

More
15 years 1 month ago #71710 by Jiliko.net
Replied by Jiliko.net on topic Hide extra field if value is empty
Do you have an example ?

Olivier

Geoff WW said:Implementing Olivier Nolbert's code causes Odd and Even rows to be out of sync.

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

More
15 years 1 month ago #71711 by Geoffww
Replied by Geoffww on topic Hide extra field if value is empty
Sure. For example I have 5 fields. For the output, the first field will have the gray color second field will have white third field will have the gray so on and so forth. When I leave the second field blank the third field will have the gray color so what happens with the output I have two rows with the gray. Indeed the ExtraField row is hidden but the odd/even coloring is out of sync. Not sure if that can be fixed. Are "odd" and "even" actual variables that can be checked for so they can be switched when the preceding ExtraField is empty?

Olivier Nolbert said:Do you have an example ? Olivier

Geoff WW said:Implementing Olivier Nolbert's code causes Odd and Even rows to be out of sync.

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

More
15 years 1 month ago #71712 by Jiliko.net
Replied by Jiliko.net on topic Hide extra field if value is empty
Ok,

It's clear for me now. Sorry.

Well, i think it's possible to check the rows in js after have hidden the empty fields.

I'll take a look this weekend.

Olivier

Geoff WW said:Sure. For example I have 5 fields. For the output, the first field will have the gray color second field will have white third field will have the gray so on and so forth. When I leave the second field blank the third field will have the gray color so what happens with the output I have two rows with the gray. Indeed the ExtraField row is hidden but the odd/even coloring is out of sync. Not sure if that can be fixed. Are "odd" and "even" actual variables that can be checked for so they can be switched when the preceding ExtraField is empty?
Olivier Nolbert said:Do you have an example ? Olivier
Geoff WW said:Implementing Olivier Nolbert's code causes Odd and Even rows to be out of sync.

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

More
15 years 1 month ago #71713 by Jiliko.net
Replied by Jiliko.net on topic Hide extra field if value is empty
The js solution (mootools) to fix the extrafields li odd/even classes

I think there's a php solution in the code i've previously posted but this one works.

Olivier

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


Powered by Kunena Forum