Question
I have a topic which includes a form.
On this topic I would like to use %IF statement, in which results will depend on formfield value specified in condition.
Formfield type: select, possible values: A, B.
If formfield=A then="X" else="Y".
Is it possible to use formfield in %IF% ?
%IF{"$formfield(formfieldName)='formfieldValue'" then="THEN" else="ELSE"}%
Environment
--
AnnaPapierz - 08 May 2007
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Reading the
IfStatements docs, it does not look like IF supports form fields. Possibly combine with
%FORMFIELD{}%
--
PeterThoeny - 09 May 2007
Peter is right. Using
FORMFIELD:
* Test on !AnsweredQuestions: %IF{"$'FORMFIELD{SupportStatus}'='AnsweredQuestions'" then="This question has been answered" else="not (so asked)"}%
* Test on !AskedQuestions: %IF{"$'FORMFIELD{SupportStatus}'='AskedQuestions'" then="This question has not been answered" else="not (so answered)"}%
Results in:
- Test on AnsweredQuestions: This question has been answered
- Test on AskedQuestions: not (so answered)
--
ArthurClemens - 09 May 2007
Thanks you all for a tip, I have already checked and this works.
--
AnnaPapierz - 09 May 2007
Does anyone know if this works with % SEARCH %? So, if the form is not on the topic, but I want to display conditional text in a search table (that is based on a form field in the topics being searched), is there a way to use the same feature?
--
LaurenSommer - 24 Oct 2007
I used the
SpreadSheetPlugin for that purpose. I tried to check whether a formfield (containing multiple values) contains the String "WarnHinweise". Here is the code:
$percntCALC{\"$IF( $SEARCH(WarnHinweise, $LISTJOIN($expand(SubjectCategory)) )>0, !! Warnhinweis !! )\"}$percnt
Don´t forget to escape the
CALC statement.
--
PeterSykora - 31 Oct 2007