We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16899
    • 284 Posts
    Hello

    How can i remove a block of html code if a TV is empty? I´m trying the below code but it´s not working!!
    What i need is if the TV property-specification is empty then don´t outputs nothing, including the H3 and UL.

    Any ideas?

    	[[*property-specification:isnot=``:then=`						
    	<h3>Specifications</h3>
    	<ul class="specifications">
    		[[*property-specification]]
    	</ul>`:else=``]]
    


    Many thanks in advance!!

    This question has been answered by Bruno17. See the first response.

    [ed. note: legues last edited this post 13 years, 5 months ago.]
      • 42967
      • 143 Posts
      [[*property-specification:notempty=`                  
      <h3>Specifications</h3>
      <ul class="specifications">
          [[*property-specification]]
      </ul>
      `]]
        Eighth day design
        Design agency with offices in Edinburgh and Brighton
        • 16899
        • 284 Posts
        Quote from: eighthday at Apr 22, 2013, 06:21 AM
        [[*property-specification:notempty=`                  
        <h3>Specifications</h3>
        <ul class="specifications">
            [[*property-specification]]
        </ul>
        `]]

        Thanks for the reply eighthday!!! smiley
        It´s not working!! sad The H3 and UL stays in the code if TV empty
          • 36996
          • 211 Posts
          Hi,
          What kind of tv is it?
          Maybe it has a default value?
          Because this code should work.
            • 16899
            • 284 Posts
            Quote from: nir-z at Apr 22, 2013, 07:41 AM
            Hi,
            What kind of tv is it?
            Maybe it has a default value?
            Because this code should work.

            Hi Niz-r

            It a TV type Checkbox and it has not any default value. Yes, the code given above maks all the sense but it´s not working!!! sad
              • 42967
              • 143 Posts
              try this:

              [[*property-specification:is=`1`:then=`                       
              <h3>Specifications</h3>
              <ul class="specifications">
                  [[*property-specification]]
              </ul>`]]

                Eighth day design
                Design agency with offices in Edinburgh and Brighton
                • 16899
                • 284 Posts
                Quote from: eighthday at Apr 22, 2013, 08:27 AM
                try this:

                [[*property-specification:is=`1`:then=`                       
                <h3>Specifications</h3>
                <ul class="specifications">
                    [[*property-specification]]
                </ul>`]]


                Now removes all the code when the TV is empty, but also when it has values!!!! It get´s closer!! smiley
                  • 3109 ☆ A M B ☆
                  • 894 Posts
                  Eigthdays code should work did you clear your cache and make sure your TV does not have a default value.
                    Benjamin Marte
                    Interactive Media Developer
                    Follow Me on Twitter | Visit my site | Learn MODX
                    • 16899
                    • 284 Posts
                    Quote from: benmarte at Apr 22, 2013, 08:43 AM
                    Eigthdays code should work did you clear your cache and make sure your TV does not have a default value.

                    All i have is Input Option Values Default Values i have empty!!!
                      • 27210
                      • 158 Posts
                      <!-- since not all devices will have 7 features, only display the 7th feature if it is there. This avoids taking up blank space at the end of the data --> 
                      [[*features-text-07:notempty=`
                      <div class="features-caption-2013">[[*features-caption-07]]</div>
                      <div class="features-picture-2013"><img src="[[*features-picture-07]]" width="240" height="190" alt="feature for 2013 Yamaha Sport Boat"></div>
                      <div class="features-text-2013">[[*features-text-07]]</div>
                      `]]


                      Not sure if the above will work for your situation.