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
sdevelopersdeveloper 

Output fields are being displayed in duplicate

Hello,  I was hoping someone could help me with a problem I have.

 

I have a Visualforce insert being displayed on the general Account Detail page which includes a large amount of fields that change based on what is put in them.  For example: if someone selects Option A in the main drop-down, then only fields relating to A will show up on the VisualForce page.  

 

I've already re-rewitten the entire Account Edit page to allow for this to happen, except now my issue occurs on the detail page.  All of the fields I have involved in my VisualForce page are being displayed again in the general account page at the bottom.  If I remove the fields from the Saleforce's Page Layout editor the fields dissapear completely from my Account Edit page and my visualforce insert.  

 

Is there any way to remove them from the general detail page without affecting my VisualForce or Edit page?

Cory CowgillCory Cowgill

Would you please provide some more details.

 

Are you using <apex:detail> tag?

 

Are you using FieldSets?

 

I think the way you want to do this is with Field Sets if I understand what you are trying to accomplish. http://www.salesforce.com/us/developer/docs/pages/Content/pages_dynamic_vf_field_sets.htm

Shiv ShankarShiv Shankar

I also encountered this problem once.

 

What was the problem :

Actually i used <apex:component> in my visual force page, that component was having <apex:form> tag.

(One <apex:form> in component and one in VF Page - so i should say i was having two <apex:form> tag)

 

What i did :

I removed <apex:form> tag in component and stated to put <apex:component> inside <apex:form> tag in to the visualforce page.

 

What possibility i think for your problem :

Might be you also using two <apex:form> tag in your VF page either directly or indirectly(like my case). and it's gives unaccepted result on reRendering.

 

sdevelopersdeveloper

The only problem is that we are using Professional and not Enterprize and I do not think I can use FieldSets

sdevelopersdeveloper

Here is the code i have on the account Edit page:

 

<apex:page standardController="Account">
      <apex:form >
        <apex:pageBlock title="Account Edit">
              <apex:pageBlockButtons location="both">
                  <apex:commandButton value="Save" action="{!Save}"/>
                  <apex:commandButton value="Cancel" action="{!Cancel}" immediate="true"/>                                
              </apex:pageBlockButtons>
              <apex:PageblockSection columns="1" title="Account Information">
                      <apex:PageBlockSection >
                      <Apex:inputSecret value="{!Account.TEST__c}"/>
                      <apex:inputField value="{!Account.OwnerID}"/>
                      <apex:inputField value="{!Account.Rating}"/>
                      <apex:inputField value="{!Account.Name}"/>
</apex:pageblocksection>
           </apex:pageblocksection>
      </apex:pageBlockSection>
      </apex:pageBlock> 
</apex:form>
</apex:page>

 Obviously there is a lot more - to contain all of the fields but I've removed those.  And here is the information for the VisualForce insert:

 

<apex:page standardController="Account">
<apex:form >
        <apex:pageBlock >
                <apex:outputField value="{!Account.EmployerHealthPlan__c}"></apex:outputfield><br></br>
                <apex:outputPanel rendered="{!Account.EmployerHealthPlan__c == null}">No Health Plan recorded yet</apex:outputPanel>
                <apex:outputPanel id="ajaxrequest">   
                  <apex:pageBlockSection rendered="{!Account.EmployerHealthPlan__c=='Employer'}">
                      <apex:outputField value="{!Account.Carrier__c}"/>
                     
                  </apex:pageBlockSection>
                  <apex:pageBlockSection rendered="{!Account.EmployerHealthPlan__c=='Health Plan'}">
                                  
                      <apex:outputField value="{!Account.Industry}"/>
                        </apex:pageBlockSection>
              </apex:outputPanel>     
    </apex:pageBlock>  
</apex:form>
</apex:page>

 

So if I go into the general Salesforce Account Page Layout editor, and remove any of these feilds from the layout, they will no longer show up on either the Edit or the VisualForce page desipte being written in the code

 

sdevelopersdeveloper

I have been able to set up a Feild Set for the Account pages however the feilds will still not show up if I take them off of the Page Layout Editor

sdevelopersdeveloper

Even if I take the <apex:form> out it still does not work. The field will not show up at all

 

<apex:page standardcontroller="Account">
<apex:pageBlock >
                <apex:outputField value="{!Account.EmployerHealthPlan__c}"></apex:outputfield><br></br>
                <apex:outputPanel rendered="{!Account.EmployerHealthPlan__c == null}">No Health Plan recorded yet</apex:outputPanel>
                <apex:outputPanel id="ajaxrequest">   
                  <apex:pageBlockSection rendered="{!Account.EmployerHealthPlan__c=='Employer'}" columns="2">
                    <apex:repeat value="{!$ObjectType.Account.FieldSets.Employer}" var="f">
                       <apex:outputfield value="{!Account[f]}">
                        </apex:outputfield></apex:repeat>
                      
                  </apex:pageBlockSection>
                  <apex:pageBlockSection rendered="{!Account.EmployerHealthPlan__c=='Health Plan'}" columns="2">
                      <apex:repeat value="{!$ObjectType.Account.FieldSets.HealthPlan}" var="f">
                       <apex:outputfield value="{!Account[f]}">
                        </apex:outputfield></apex:repeat>                   
               </apex:pageBlockSection>
              </apex:outputPanel>     
    </apex:pageBlock>
</apex:page>

 

ACANewUserACANewUser
Was this ever resolved?
sdevelopersdeveloper

Eh i found a workaround...but not really.  I ended up just rewritting the entire page in apex code

ACANewUserACANewUser
Alright, thanks.