Categories > TinyButStrong general >

conditional compare with apostrophe

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jared
Date: 2011-01-05
Time: 22:34

conditional compare with apostrophe

Hi,

I am doing a conditional compare like this:

<option value="[custd.val;block=_]"[custd.val;if [val]=[var.myobject.custd];then ' selected'; else '';]>[custd.val]</option>

But, I have situations where [var.myobject.custd] contains a value like O'Rly. The conditional is not able to match this value. Any suggestions?
By: Skrol29
Date: 2011-01-05
Time: 22:40

Re: conditional compare with apostrophe

Hi,

Try
if [val]='[var.myobject.custd;htmlconv=esc]'
By: Jared
Date: 2011-01-06
Time: 01:46

Re: conditional compare with apostrophe

Hi Skrol29,

Thanks for the fast help!

Unfortunately, that did not work.
By: Jared
Date: 2011-01-06
Time: 01:50

Re: conditional compare with apostrophe

Hmm, so I just got it to work! I needed to also htmlconv=esc the val also. Here is what it looks like now:

<option value="[custd.val;block=_]"[custd.val;if [val]='[var.myobject.custd;htmlconv=esc]';then ' selected'; else '';htmlconv=esc]>[custd.val]</option>

Thanks again for all your hard work!