You need to sign in to do that
Don't have an account?

Inline VisualForce "IF" statement
Hi all,
I am trying to display some content, which is dependent in a Boolean variable in my controller. First I tried the following code:
Code:
{!IF({!isBrandedChannel},"SOMECONTENT", "SOMEOTHERCONTENT")}
where {!isBrandedChannel} is the Boolean variable. This wouldn't compile in Eclipse and hence wouldn't save to the server.
Next I tried using the "rendered" tag of the Visualforce component. However the limitation here is that I need 2 components that would be declared something like:
Code:
<apex:repeat value="{!newIOs}" rendered="{!isBrandedChannel}" var="io"> and <apex:repeat value="{!newIOs}" rendered="NOT({!isBrandedChannel})" var="io">
However the "NOT" function doesn't work here.
Eventually I declared 2 variables in my controller, one the normal isBrandedChannel variable, the second giving me the inverse of this, and used these on my 2 seperate repeat components.
This seems strange to have to do this. Is there a better way?
That is illegal, it should look like this:
Should look like this:
same thing again here:
<apex:repeat value="{!newIOs}" rendered="NOT({!isBrandedChannel})" var="io">
Please promote/vote on this idea if you want to see us add this functionality :-)
Thanks for the replies so far, the nested {! tags was the problem. However, I note that in the Visualforce developer guide (summer 2008), the following is given as example code for the NOT function
which would appear to contain nested tags, but perhaps the nested tags only applies to the conditions of the if statement?
So my problem has moved on a little. I am trying to conditionally output a column in a table, depending on the value of isBrandedChannel. For the body of the table I am using 2 conditional repeat components which works fine. The problem I have is with the header of the table. I need to conditionally output the following code, to include the column header:
When I use the IF statement to output HTML, it produces "escaped" HTML. I couldn't see a way around this. So I decided to use the outputText component like so:
However I got an error in Eclipse saying "The value of attribute "value" associated with an element type "apex:outputText" must not contain the '<' character. at line 22". This seemed very strange given that there is an "escape" attribute on this component.
I also tried this with the following format:
which is actually the closest I've gotten to getting it to work the way I want to, however for some reason this inserted a whole pile of extra table tags and pushed this column header out to the side.
Anyone got any suggestions on a way around this?
And here is the page (this is step 2 of a 2 step process
Any further help here would be greatly appreciated!
I think I have a handle on what you are trying to do. Your best bet is to try to use our components before dropping to HTML. In this case I suspect you were not aware of pageblocktable and how you can leverage the column's rendered attribute directly.
I took a stab at how I thought you might want it to be but I did make a few mods:
1) Changed your controller accessors to use the new property syntax (didn't touch your inner, wrapper class)
2) Removed some custom fields since I didn't feel like creating them :)
3) Switched to use the standard type field on oppty (again, my laziness)
4) removed the opportunityId member from the controller - didn't seem to be used
5) added a debugging pageblock, just click the checkbox to toggle the visibility of the second column
6) Removed page references from your wizard navigation (more dependency laziness :) )
7) Cut out action method code since it's not needed to convey the goal
Let me know if I am on the right track here.....
Message Edited by mtbclimber on 06-06-2008 01:15 PM