Hi-
I just spent a couple of hours fighting with conditional shortcodes in version 1.6.11 and in the process I think I've located both a real bug and an omission in the documentation. Let me mention my struggle with the documentation first because the other bug can be worked around.
The documentation shows this:
[gravityforms action="conditional" merge_tag="{Country:5}" condition="is" value="United States"]
The place that I think it is very easy to get tripped us is the doc on first glance might lead you to believe that when you write merge_tag to reference a form field, the "value" attribute could be specifying the value of the field included by the merge tag, not the value that would be inserted by the merge tag. Now I know this is not the case.
It's entirely possible this was just my own bias that caused me to think that something called 'value' in a shortcode would be same as what gets called a "value" in the form designer ("show values"). If the docs for the conditional shortcode could make it clear that the comparison gets done against the field label by default or field value if you add a :value to the merge_tag (perhaps with an example showing field:ID:value), that would have made a world of difference to me and perhaps others.
So let's say you had a radio button form element like this:
Form Element 6 "Where is Carl"
"He is in Mexico again|MEXICO"
"He is in a coffee shop|COFFEE"
This means the conditional code has to say either:
[gravityforms action="conditional" merge_tag="{Where is Carl:6}" condition="is" value="He is in Mexico again"]
or
[gravityforms action="conditional" merge_tag="{Where is Carl:6:value}" condition="is" value="MEXICO"]
Ok, now the real bug:
If you use a radio button element and have a field label that includes an apostrophe, the conditional shortcode logic breaks in a very interesting way. Even if you insert that apostrophe not as a single quote, but as the HTML entity ’
it still breaks. I found that it never properly does a comparison. So in the example above, if the form element was:
Form Element 6 "Where is Carl"
"He is in Mexico again|MEXICO"
"He is cryin' in his coffee|COFFEE"
(in my case the actual Field label was [Second Line Social Aid and Pleasure Society Brass Band: "I Feel Like Funkin’ It Up"])
you will find that any comparison, even for a different value in the same element, like this from above:
[gravityforms action="conditional" merge_tag="{Where is Carl:6:value}" condition="is" value="MEXICO"]
will not succeed. My theory is the code that parses merge tags throws up its hands if it finds an extra quote, but that's only a guess. I haven't had a chance to dig through the code to confirm this.
Anyway, thanks for all of the hard work putting in the conditional shortcode functionality. Now that my head is screwed on right about it, it rocks.
-- dNb