Attention:

Support Rules and Guidelines
Before you post your support topic, please remember to:
  • Read the support forum rules.
  • Check the wiki and use search to see if your problem can be answered there first.
  • Link your board please, and make sure that the problem on your board is visible to guests or provide a test account.
  • Do not post Board Wrappers and CSS unless requested. With a board link, this is not necessary.
  • Be as descriptive as you can and use as many details as possible when describing your problem.
  • Please briefly mark any links to forums that may not be work-safe.
This will help ensure your support issue will be attended to in a quick and efficient manner.

  ClosedNew TopicNew Poll

 Removing Empty MiniProfile Fields [SOLVED]
#
There are two fields in my miniprofile that can be left blank, and I'd like to remove them when they are blank. I've done some looking around to find out how to do this. So far, this is how I have it coded.

HTML templates:
CODE
<span class='minigames'><p class="mpInfo"><span class="fctitle">Games</span> <!-- |field_18| --></p></span>
<span class='mininick'><p class="mpInfo"><span class="fctitle">Nickname</span> <!-- |field_7| --></p></span>


CSS under <% BOARD %>
CODE
<script>$('.mininick:contains("N/A")').remove();</script>
<script>$('.minigames:contains("N/A")').remove();</script>


I've seen this works for others, but I can't get it to work for me.
PM
#
Try this conditional instead:

CODE
if('<!-- |field_18| -->' != '') { document.write('<span class="minigames>"<p class="mpInfo"><span class="fctitle">Games</span> <!-- |field_18| --></p></span>'); }</script>


It will work better for this use case;

Also a small note; MP fields don't output N/A anymore they just return empty.

signature
email: admin@jcink.com :: blog: John C.
#
Okay, so I don't know if I have this plugged in right, I'm pretty new to javascript.

I now have
CODE
<script>if('<!-- |field_18| -->' != '') { document.write('<span class="minigames>"<p class="mpInfo"><span class="fctitle">Games</span> <!-- |field_18| --></p></span>'); }</script>
<script>if('<!-- |field_7| -->' != '') { document.write('<span class="mininick>"<p class="mpInfo"><span class="fctitle">Nickname</span> <!-- |field_7| --></p></span>'); }</script>


under <% BOARD %>. Which I can't have done it right, because it's not working. lol

This post has been edited by DesiTack: Apr 16 2018, 08:38 PM
PM
#
Not under <% BOARD %>, that must be placed in Mini Profile. Put it in place of where the field HTML currently is.

signature
email: admin@jcink.com :: blog: John C.
#
I edited the script a little and plugged in

CODE
<script>if('<!-- |field_18| -->' != '') { document.write('<p class="mpInfo"><span class="fctitle">Games</span> <!-- |field_18| --></p>'); }</script>
            <script>if('<!-- |field_7| -->' != '') { document.write('<p class="mpInfo"><span class="fctitle">Nickname</span> <!-- |field_7| --></p>'); }</script>


and this is working perfectly now!
Thanks so much for your help, John!

This post has been edited by DesiTack: Apr 17 2018, 06:03 PM
PM
#
This topic has been solved. If you need anymore help please post a new thread. Thanks for choosing Jcink services.

signature
email: admin@jcink.com :: blog: John C.
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Share this topic:
« Next Oldest | General Support | Next Newest »

Options ClosedNew TopicNew Poll