This question about Topic Markup Language and applications: Answered

Conditional include - best practices

I need to include other topics conditionally - if this is intended by user who wrote an article.

I resolved it as follows. In my template I have attached DataForm with following field:

| dispGlobal | checkbox | 1 | YesChecked | | |

and then I use in my view template:

This works properly. However, I wonder if this is the best practice/suggested solution.

What if I need to display particular text if any of the three checkboxes in my DataForm is checked? Condition will be quite long and error prone. If am correct, it will be:

%IF{"'%FORMFIELD{"dispGlobal"}%'='YesChecked' or '%FORMFIELD{"secondCheckbox"}%'='YesChecked' or '%FORMFIELD{"thirdCheckbox"}%'='YesChecked'" then="Any text or include"}%

-- MateuszKDzior - 06 Nov 2015

I think your solution is fine. Why do you suggest that it is error prone? If the values are as simple as you present above, you could conceivably simplify the condition as follows
%IF{"'%FORMFIELD{"dispGlobal"}%%FORMFIELD{"secondCheckbox"}%%FORMFIELD{"thirdCheckbox"}%'~'*YesChecked*'" then="Any text or include"}%

-- LynnwoodBrown - 16 Nov 2015

QuestionForm edit

Subject Topic Markup Language and applications
Version Foswiki 2.0.2
Status Answered
Related Topics
Topic revision: r3 - 17 Nov 2015, LynnwoodBrown - This page was cached on 23 May 2019 - 13:56.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy