Hi Visualforce experts:  Is it possible to dynamically resize a Visualforce Page based on a specific condition?  For example, on my page - warning #2 is displayed only when a condition is met.    If this condition is not met, the warning is not shown.  Warning #1 is always static/does not change.  I would like to essentially resize my page when the condition is not met.    &lt;apex:page standardController="Opportunity" extensions="OpportunityControllerExtension"&gt;  &lt;apex:stylesheet value="{!$Resource.alerts}"/&gt; &lt;apex:stylesheet value="{!$Resource.infoIcon}"/&gt;  &lt;warning&gt; &lt;img src="{!$Resource.infoIcon}" border="0"/&gt;  &lt;apex:outputLabel value="Opportunities may be submitted for Approval and/or     Resource Assignment at Stage 3 or later."&gt; &lt;/apex:outputLabel&gt;  &lt;/warning&gt;  &lt;apex:form rendered="{!Opportunity.Account.NumberOfEmployees == 0}"&gt;  &lt;apex:stylesheet value="{!$Resource.alerts}"/&gt; &lt;apex:stylesheet value="{!$Resource.infoIcon}"/&gt;  &lt;warning&gt; &lt;img src="{!$Resource.infoIcon}"border="0"/&gt;  &lt;apex:outputLabel value="Please populate the Number of Employees on the "&gt;&lt;a     href="/{!opportunity.AccountId}/e?retURL={!opportunity.Id}" title = "Click    here to go Edit the Account" target="_blank"&gt;{!opportunity.Account.Name}&lt;/a&gt;    Account before moving forward. &lt;/apex:outputLabel&gt;       &lt;/warning&gt;  &lt;/apex:form&gt;  &lt;/apex:page&gt;
35014
Since it seems to me, that a lot of people still need sidebar workarounds, I would be interested to learn about the use-cases, experienced challenges and (most important) possible strategies to avoid them by using different approaches. This is related to the methods discussed here:   In my experience there are a few extremely important and constantly repeating patterns, which to my knowledge are still very hard to be solved using more official techniques. I will also contribute my own top-N use-cases, which are mostly related to UX and UI concerns. You are very welcome to add your own scenarios as answers and add comments on how you would avoid a workaround. My dream would be to team-elaborate strong and repeatable solution-patterns for the most common use-cases.  Finally I would be interested in the experiences of all of you who participate in the Aura pilot, which hopefully could make this kind of workarounds obsolete.
41926
We're about to go live with Live Agent (the version that built into your Salesforce instance).  We're using some a prechat form which appears as a popup window when the user clicks the "Chat" button.  When the window pops up, our form doesn't fit fully inside. I'm trying to find where to define the size of that pop-up window.  I can't find it in any setting, and changing the Visualforce page that represents the Pre Chat form doesn't make a difference.  Does anyone know where the Size of the pop up window is referenced?   Update**  ***Per the comment below - I also thought it would be in the code for the button. Nearest I can tell it calls a method onclick called "Liveagent.startChat()" but I don't see that javascript anywhere.  &lt;body style="background:transparent"&gt;         &lt;span class="buttonSmall"&gt;                                                 &lt;a id="liveagent_button_online_573400000004CMA" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('573400000004CMA')"&gt;                 &lt;img src="~/hgstatic/img/hgLiveChatButtonBig.png" alt="Live Chat" /&gt;             &lt;/a&gt;          &lt;/span&gt;                &lt;div id="liveagent_button_offline_573400000004CMA" style="display: none;"&gt;&lt;a href="http://www.healthgrades.com/contactus?application=manage-my-profile" target="_new"&gt;&lt;img src="~/hgstatic/img/hgContactUsBig.png" alt="Contact Us" /&gt;&lt;/a&gt;&lt;/div&gt;           &lt;script type="text/javascript"&gt;              if (!window._laq) { window._laq = []; }              window._laq.push(function () {                  liveagent.showWhenOnline('573400000004CMA', document.getElementById('liveagent_button_online_573400000004CMA'));                  liveagent.showWhenOffline('573400000004CMA', document.getElementById('liveagent_button_offline_573400000004CMA'));              });         &lt;/script&gt;                        &lt;script type='text/javascript' src='@ConfigurationManager.AppSettings["SalesForceScriptLink"]'&gt;&lt;/script&gt;         &lt;script type='text/javascript'&gt;             liveagent.init(@Html.Raw(ConfigurationManager.AppSettings["SalesForceLiveAgentInitLink"]));         &lt;/script&gt;     &lt;/body&gt;
121438
I am using jQuery library in my visual force page, but I've faced a major problem when I tried to use tabs "apex:tabPanel".  &lt;script src="{!$Resource.jQuery}"&gt;&lt;/script&gt; &lt;!-- If I delete this script the tabs work !! --&gt;  &lt;apex:tabPanel tabClass="activeTab" inactiveTabClass="inactiveTab"&gt;   &lt;apex:tab label="Tab#1" id="tab1"&gt;&lt;/apex:tab&gt;   &lt;apex:tab label="Tab#2" id="tab2"&gt;&lt;/apex:tab&gt; &lt;/apex:tabPanel&gt;   I get a "JS" errors in the console when I try to click on any tab, but if I delete jQuery library it works. So I guess there is a conflict between jQuery and apex:tabPanel functionality.    Here's what I got in the console   Uncaught ReferenceError: initViewstateTab is not defined  Uncaught TypeError: Object [object Object] has no method 'dispatchEvent'  Uncaught ReferenceError: initViewstateTab is not defined  event.returnValue is deprecated. Please use the standard event.preventDefault() instead. Uncaught TypeError: Object [object Object] has no method 'hasClassName'  Uncaught TypeError: Cannot call method 'replace' of undefined
121012
I have a VF page on the Account.  I have set up 3 radio selections using apex:selectRadio and a Script.  I would now like to populate custom fields on the Account (Field1__c, Field2__c, Field3__c) with the radio selection the user chose. These fields are checkboxes.  Does anyone know how I can do this?  Thanks,  &lt;apex:page standardController="Account" tabStyle="Account"&gt;  &lt;script&gt;      function TypeSelect(variable)     {         var choice = variable.value;         if(choice == 'Amplify'){             document.getElementById('layoutAmp').style.display = 'block';             document.getElementById('layoutEng').style.display = 'none';             document.getElementById('layoutAge').style.display = 'none';             document.getElementById('{!$Component.theForm.AmpVal}').value = 'true';         }         else if(choice == 'Engage'){             document.getElementById('layoutAmp').style.display = 'none';             document.getElementById('layoutEng').style.display = 'block';             document.getElementById('layoutAge').style.display = 'none';             document.getElementById('{!$Component.theForm.EngVal}').value = 'true';         }         else{             document.getElementById('layoutAmp').style.display = 'none';             document.getElementById('layoutEng').style.display = 'none';             document.getElementById('layoutAge').style.display = 'block';             document.getElementById('{!$Component.theForm.geVal}').value = 'true';         }     }    &lt;/script&gt;  &lt;style&gt;     input[type=radio] {margin-left: 100px;}     .radioClass {margin-left: 25%;} &lt;/style&gt;  &lt;apex:form id="theForm"&gt;     &lt;apex:actionRegion &gt;      &lt;Table width="90%" border="0" cellpadding="0" cellspacing="0" columns="5"&gt;         &lt;tr&gt;             &lt;td colspan="5" class="fieldLabel"&gt;                 &lt;apex:selectRadio layout="lineDirection" styleClass="radioClass" onclick="TypeSelect(this);"&gt;                     &lt;apex:selectOption itemLabel="Amp" itemValue="Amp"&gt;&lt;/apex:selectOption&gt;                     &lt;apex:selectOption itemLabel="Eng" itemValue="Eng"&gt;&lt;/apex:selectOption&gt;                     &lt;apex:selectOption itemLabel="Age" itemValue="Age"&gt;&lt;/apex:selectOption&gt;                 &lt;/apex:selectRadio&gt;                     &lt;apex:inputHidden id="AmpVal" value="{!Account.Amp_Account__c}" /&gt;                     &lt;apex:inputHidden id="EngVal" value="{!Account.Eng_Account__c}" /&gt;                     &lt;apex:inputHidden id="AgeVal" value="{!Account.Age_Account__c}" /&gt;                 &lt;apex:actionSupport event="onchange" reRender="Detail"/&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/Table&gt;
58184
I have an output panel inside my apex:repeat tag.  My requirement is to conditionally display it.  So for one element in apex:repeat this panel might be rendered ..for some not. Rendering condition is,i need to check whether  line item occurs in  another controller set variable.  I find it difficult because of following reasons;  1)I understand you cannot check whether a set variable contains this element on visualforce page .or is this possible  2) i can see you cannot pass arguments in your rendered attribute.else i could have specify a boolean value for rendered attribute and set the value based on lineitem passed from front end  3)as the set variable is totally unrelated to line item.i cannot simply specify as below  &lt;apex:repeat value="{!Proposals}" var="item"&gt;         &lt;apex:outputPanel rendered="{!item.LineCount &gt; 0}"&gt;             &lt;li&gt;              &lt;/apex:outputPanel&gt;     &lt;/apex:repeat&gt;   Any clue experts Also it is one icon on the element i don't want to display.(not the whole element as such)(but that doesnt make much difference i guess)
51121
can any one help me out in this.I have created a custom visual force page on "quote " object in a PDF format where the data gets displayed .Now Can we create a summary Report like data with subtotal and grandtotals in a visual force page in a PDF format.Any suggestion plz.   Using an tag as and passing a hard core value in a Visualforce page in a PDF.  &lt;analytics:reportChart ReportId="XXXXXXXXXXXXX" showRefreshButton="true" size="huge" cacheResults="false" /&gt;
76271
I was looking at some code and in the 'apex:page' tag, an attribute called recordSetVar was mentioned. I'm new to VisualForce so could someone please tell me when and why is it used?
61221
I have an apex:commandButton on a visualforce page that invokes a method on the controller. There is currently no rerender value set for the button. Instead the controller method returns a PageReference to redirect the user as required.  E.g.  Visualforce:  &lt;apex:commandButton value="Save" action="{!save}"/&gt;   Controller:  public PageReference save() {     // save body ...      // return the user the a parent opportunity     return new PageReference('/' + opp.Id); }   Users are currently able to click on the resulting save button multiple times before the controller completes and returns the PageReference to redirect the browser to an opportunity.  How can I disable the commandButton after the first click?    I tried wrapping the commandButton in an actionStatus and facet, but the need to define the rerender property prevented the resulting PageReference redirect.  E.g.  This will render nicely in the browser and prevent multiple clicks, but doesn't redirect to the Opportunity on completion.  &lt;apex:actionStatus id="saveStatus"&gt;     &lt;apex:facet name="stop"&gt;         &lt;apex:commandButton value="Save" action="{!save}" status="saveStatus" rerender="saveParentBlock" /&gt;     &lt;/apex:facet&gt;     &lt;apex:facet name="start"&gt;         &lt;apex:commandButton value="Saving..." disabled="true" status="saveStatus"/&gt;     &lt;/apex:facet&gt; &lt;/apex:actionStatus&gt;     There is a similar question . I need to support an existing PageReference redirect, which slightly alters the requirements.  Force.com Discussion Boards:   Ideas:
6732
I have a custom search page for use in Customer Portal.  VF Page:    &lt;form name="frmSearch"&gt;      &lt;input type="text" name="keyword" id="keyword" value="{!portalSearchModel.searchTerm}" onkeypress="return noenter(event);" style="width:25%; height:25px;margin:0; padding: 0px 6px 0px;" placeholder="What are you looking for?" /&gt;      &lt;input type="button" id="btnSearch" name="btnSearch" value="Search" onclick="searchTerm()" class="go-we3" /&gt;   &lt;/form&gt;   &lt;script type='text/javascript'&gt;       function searchTerm(){         var searchTerm = document.getElementById("keyword").value;          var url="/apex/PortalSearch?s="+searchTerm;          window.location = url;          return false;     }          &lt;/script&gt;   Is there a way to call this apex method in Controller on button click along with the JavaScript?      public void logSearchTerm(){         portalSearchModel.searches();         Search_Log__c sl = new Search_Log__c();          sl.search_term__c = portalSearchModel.searchTerm;         sl.user__c = UserInfo.getUserId();              insert sl;  }
97536
My vf page     &lt;apex:page renderAs="pdf" Controller="testpdf1"&gt;     &lt;head&gt;         &lt;style type="text/css" media="print"&gt;             @page              {                 size: 8.5in 11in;/* width height */             }              @page              {                 @top-center                  {                     content: element(header);                 }                  @bottom-left                  {                     content: element(footer);                 }             }              div.header              {                 padding: 10px;                 position: running(header);             }              div.footer              {                 display: block;                 padding: 5px;                 position: running(footer);             }              .pagenumber:before              {                 content: counter(page);             }              .pagecount:before              {                 content: counter(pages);             }         &lt;/style&gt;     &lt;/head&gt;      &lt;div class="header"&gt;             &lt;div align="right"&gt;Header&lt;/div&gt;     &lt;/div&gt;      &lt;div class="footer"&gt;         &lt;div&gt;Page &lt;span class="pagenumber"/&gt; of &lt;span class="pagecount"/&gt;&lt;/div&gt;     &lt;/div&gt;      &lt;div class="content"&gt;         &lt;p&gt;             &lt;apex:repeat value="{!opp}" var="item"&gt;                 &lt;tr&gt;                     &lt;td class="tableContent"&gt;{!item.Name}&lt;/td&gt;                 &lt;/tr&gt;             &lt;/apex:repeat&gt;         &lt;/p&gt;     &lt;/div&gt; &lt;/apex:page&gt;   Controller  public class testpdf1 {     public list&lt;Account&gt; opp{get;set;}      public testpdf1()     {         opp=[SELECT Name  from Account limit 50];     } }   I am getting all records in pdf format but able to get header in first page only and i am not getting header from second pages how can i display header to all pages.
79320
For example, my component has the following section that displays a record form:  &lt;template if:true={showRecordForm}&gt;     &lt;lightning-record-form         object-api-name={sObjectApiName}         onsuccess={handleFormSuccess}         record-type-id={recordTypeId}         layout-type="Full"         columns="2"         oncancel={handleFormCancel}         onload={handleFormLoad}&gt;     &lt;/lightning-record-form&gt; &lt;/template&gt;   It will load the form for the object I specify in sObjectApiName, and with the specified record type as well. The problem is that I want to assign some values to specific fields.  Let us say that it is a Case form, and I want to assign an Account ID to the AccountId field, before the case is submitted to the platform.  I tried to query the lightning-input-fields, but with no success:  const inputFields = this.template.querySelectorAll(     'lightning-input-field' ); if (inputFields) {     inputFields.forEach(field =&gt; {         console.log(field)     }); }   This is a snippet from the .  I'm starting to think that this might not be viable, or too much trouble. Is there a way to do this?
28879
I have Visual Force Component:  &lt;apex:component controller="myController1" access="global"&gt;  &lt;p /&gt;  &lt;apex:outputLink id="urlString" value="{!url}/{!$User.Id}&lt;/apex:outputLink&gt; &lt;br /&gt;  &lt;apex:outputLabel value="{!userName}" id="someId" /&gt;  &lt;apex:outputLabel value="{!userPhone}" id="someId2" /&gt;  &lt;/apex:component&gt;   How to access the username only from visual force component to Visual force template in email alert using Work flow Rule in salesforce ,please Anyone Guide me for the Answer  I have tried in Vf template:  &lt;br&gt;User &lt;c:ant id = "someId" value = "{!userName}"/&gt;&lt;/br&gt;   but it is showing error like: Error: Unsupported attribute value in   How to Rectify the Error Please anyone Guide me for the Answer
58280
I'm trying to center a fixed size control within a form.  Out of interest, is there a non-idiotic way of doing this? What I really want is something analogous to the text-align css property.  At the moment, I'm setting the padding property of the surrounding form to a suitable size and setting the Dock property of the control to fill.
111610
I am not sure why Visualforce has this limitation that you can't call parameterized method directly from Visulaforce.  Can anybody explain the reason?  Edit  public string getFormatMe(string a) {     // do manipulation here     return a; }   i can't call this function from visualforce directly like getFormatMe('xyz');
97311
Are there any documents out there that talk about proper formatting in apex? I have not been able to find too much on this subject (maybe my google skills are weak).  Some examples:   //comment with no space  // comment with space   if (something == something) { String foo = "keep it in one?"; }   if(something==something)       String foo="Or do it this way?";   I realize that this is probably based off of the user's preference, but I'm wondering if there is a standard to do things a certain way in apex? Would writing the syntax one way or the other affect the performance?
113421
i have a visualforce page where i displays a grid with checkbox selection for each row in it. The issue is when i select the checkboxes in page 1 and navigate to page 2 and comes back to page 1, the checkbox selection disappears(unchecked) in page 1. i need to retain and display the checkbox selections while i moving across the pages back and forth. How can i fix this? please help.
17067
I have three rows on a Visualforce page. The requirement is that when any value of this field is blank it will show the error message on the page. I have to do this with the help of JSON and by using the following javascript function but I'm stuck. I am new on salesforce and JSON  &lt;script type="text/javascript"&gt;    var text = '{"val":['{"TValueFields"}' ] }';     obj = JSON.parse(text);              function findBlank() {             debugger;                        for (i=0; i&lt; obj.length; i++)               {                         var js = JSON.stringify(obj);              if(document.getElementById(js).value == " ")               {                          alert("TValueFields must be select");               }                     i++        } &lt;/script&gt;