function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
seelseel 

Newbie Apex help - display div in page on quote if any Quote Line Item has certain picklist value

I'm new to salesforce.com and VisualForce/Apex.  I have developed a custom Page that renders a PDF, but I need to conditionally display content based on a field value set on a product - if that product is a line item on the quote.

 

Specifically when I load this page from the quote and display quote information and line item detail (already done), I need to display a div if any of those products' "Agreement_Supplement__c" picklist field contains the value "Supplement A" - but I have another div that needs displayed if that same picklist field contains the value "Supplement B".  It seems that I need to create a function that takes in the orderid and supplement name and returns a true/false.

 

Esentially in my page I would like to be able to do something similar to if(hassupplement(theorderid, thesupplementname),"display:block;","display:none;").  I've read through the documentation and tried a few things, but haven't been able to acomplish this yet.

Andy BoettcherAndy Boettcher

1)  Use apex:outputPanel instead of Div.

 

2)  Use the "rendered=<your formula>" in the apex:outputPanel.

 

-Andy

Nisse Knudsen.ax1026Nisse Knudsen.ax1026

In addition to techman97s answer:

 

Please note the 'layout' attribute that comes with the <apex:outputpanel/> tag:

 

The layout style for the panel. Possible values include "block" (which generates an HTML div tag), "inline" (which generates an HTML span tag), and "none" (which does not generate an HTML tag). If not specified, this value defaults to "none". However, if layout is set to "none", for each child element with the rendered attribute set to "false", the outputPanel generates a span tag, with the ID of each child, and a style attribute set to "display:none". Thus, while the content is not visible, JavaScript can still access the elements through the DOM ID.

 So, if you especially need to have a div-tag, you could set layout="block".