9

This is what I am trying to do:

{{if var data.request_quote=="on"}} Yes {{else}} No {{/if}}

Where var data.request_quote is a form variable. It keeps coming out as No, even if data.request_quote is on.

1 Answer 1

9

There are two problems with this code

  1. There is no var keyword in the if directive
  2. The template filter cannot evaluate conditions. You should give request_quote a boolean value (or leave it empty if it is not "on")

Then the correct code is:

{{if data.request_quote}} Yes {{else}} No {{/if}}
5
  • 1
    But this always evaluates to true, when request_quote is 'No' or 'on' or whatever, right? Sep 30, 2015 at 10:37
  • 1
    That's why I said, request_quote should be changed to a boolean value (or empty instead of "off") Sep 30, 2015 at 10:38
  • Reading after lunch is quote hard. thanks. Sep 30, 2015 at 10:40
  • What if I cant change request_quote to a boolean? It is a string.
    – Jimmery
    Sep 30, 2015 at 11:45
  • I don't know where data comes from but you must find a way to modiy it or add new variables. Sep 30, 2015 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.