We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38525
    • 26 Posts
    I am using a checkbox TV to output some HTML based on the selection, but encountered a problem with that.

    When I select the desired checkboxes and then save the resource, everything is being processed like it should. But when I revisit the resource, none of the checkboxes are selected anymore, thus emptying the TV again on save.

    The checkbox input option values I used:
    Preventie==<a class="preventie"></a>||Gewicht==<a class="gewicht"></a>||Darmen==<a class="darmen"></a>||Hart==<a class="hart"></a>||Hersenen==<a class="hersenen"></a>||Energie==<a class="energie"></a>


    I just found out that it's the "" things causing the problem.. When using the default
    option==1
    method, the selected checkboxes are remembered. Does anyone know if it's possible to somehow make it work this way, or do I have to load the HTML in a different manner? [ed. note: suikerzout last edited this post 12 years, 2 months ago.]
      • 31946
      • 116 Posts
      Hi suikerzout,
      You should not include HTML there, that should happen in a Template or Chunk.
      Try this:
      Preventie==preventie||Gewicht==gewicht||Energie==energie

      User the Delimiter Output type of the TV, for example with a comma.
      Create a snippet createLinks:
      <?php
      $values = explode(',',$input);
      $output = '';
      foreach($values as $value){
        $output .= '<a class="'.$value.'"></a>';
      }
      return $output;

      Then use this snippet as an output modifier:
      [[*yourTVName:createLinks]]
        • 38525
        • 26 Posts
        Awesome Wanze, that works like a charm smiley

        Thanks a lot!