Created a tv with the name "formSize", indicated the li tag in the output parameters. Inside the page template is written:

[[!getResources? &parents=`[[*id]]` &tpl=`form` &includeTVs=`1` &processTVs=`1`]] 

In the form chunk, there is a list of ul, inside of which is the given tv. (If tv is full, it appears inside ul and becomes the next item in the list).

But if tv is empty, it is output as an empty li:

 <li></li> 

How can this be fixed?

1 answer 1

In the form chunk, output tv only if it is not empty, using output modifiers:

 [[+formSize:notempty=`[[+formSize]]`]] 

More about modifiers (eng.)

  • I have already tried this option, for some reason it does not work. Now I checked it again, I used [[+ tv.formSize: notempty = [[+tv.formSize]] ]] - the empty li tag still appears. Without the prefix "tv." In the chunk, the field is not displayed at all. - ov seo
  • I looked through, remove the output parameters of the tv field, the li tag and in the chunk write: [[+tv.formSize:notempty=`<li>[[+tv.formSize]]</li>`]] - Tunker
  • Thank you It helped, li no longer appear. At the same time, the problem was solved with unnecessary id, which were automatically created in the form of "tvformSize" when filling tv. - ov seo