• Jakem
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies

Hi everyone,  

 

I'm having a tough time figuring this out. I have a modal popup with an inputField and a javascript button that calls an actionFunction to save the object. Unfortunately I can't get the inputField values in the modal to pass to the controller so it won't update. Not sure how to fix this so I came here. Here's the code:

 

//////////
//Page
//////////

<apex:page standardController="Opportunity" extensions="extensionOpportunity" id="pgOpportunity" >

    ///JQuery
    <script src="{!URLFOR($Resource.jQueryDCS,'/js/jquery-1.5.1.min.js')}" type="text/javascript" />
    <script src="{!URLFOR($Resource.jQueryDCS,'/js/jquery-ui-1.8.13.custom.min.js')}" type="text/javascript" />
    <apex:stylesheet value="{!URLFOR($Resource.jQueryDCS,'/css/ui-lightness/jquery-ui-1.8.13.custom.css')}" />

<apex:outputPanel id="modalJQuery">

//Script to bring up modal
<script>
    
    var j$ = jQuery.noConflict();
    
    j$(document).ready(function(){
    
        j$( "#dialog-form" ).dialog({
            autoOpen: false,
            height: 325,
            width: 350,
            modal: true,
            buttons: {

                //This function calls the actionFunction
                "Save": function() {
                    afSaveOpp();
                },
                Cancel: function() {
                    j$( this ).dialog( "close" );
                }
            },
            close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });
    });
    
    function statusShow() {
        j$( "#dialog-form" ).dialog( "open" );
    }
    
    function statusHide() {
        j$( "#dialog-form" ).dialog( "close" );
    }
    
</script>

//The modal popup
<div id="dialog-form" title="Opportunity Edit">
<apex:form >
    <apex:pageBlock mode="maindetail">

        //Field that should be updating
        <apex:inputField value="{!opportunity.Name}" id="inName"/>
    </apex:pageBlock>
</apex:form>    
</div>
</apex:outputPanel>

<apex:outputPanel id="pnlMain">

<apex:form id="frmMain">
    
    //actionFunction that calls save method
    <apex:actionFunction id="afSaveOpp" name="afSaveOpp" action="{!save}" oncomplete="statusHide()">
    </apex:actionFunction>

</apex:form>
</apex:outputPanel>
    
</apex:page>
///////////////
//Controller
///////////////

public with sharing class extensionOpportunity {
    
    public final Opportunity o {get; set;}
    
    public extensionOpportunity(ApexPages.StandardController controller) {
        this.o = (Opportunity)controller.getRecord();
    }
    
    public void doNothing() { }
   
    public void saveOpp() {
        update o;
    }

}

 

I'd appreciate any help in understanding what's going on here.

  • May 09, 2012
  • Like
  • 0

Hi everyone,

 

Sorry if this is a stupid question but here goes. I have a visualforce page that displays a custom table of child objects related to Opportunities and one of the columns is an outputLink to the child object page. The link is based on a lookup field. My page is imbedded in a section of a standard page layout. My problem is that when I click the link, the page I want to redirect to displays in the section in the Opportunity page instead of the full window. 

 

Here is my VF code (unnecessary stuff removed):

 

<apex:page standardController="Opportunity" extensions="AllocateBudgetextension" id="opportunity" showHeader="false" sidebar="false" standardStylesheets="true">
<apex:form >
<apex:pageBlock id="block" mode="maindetail">
<apex:pageBlockSection columns="1">
<apex:outputPanel id="table">

<apex:pageBlockTable value="{!CampaignListDummys}" var="dummy" rendered="{!(CampaignListDummys.size != 0)}" style="margin-bottom:5px">
<apex:column headerValue="Action" width="50px">
<apex:commandLink action="{!removeCampaign}" reRender="table">
<apex:param name="cid" value="{!dummy.budgets.Id}" assignTo="{!dcbid}"/>Remove
</apex:commandLink>
</apex:column>
<apex:column headerValue="Allocation" width="110px">
<apex:outputField value="{!dummy.budgets.Budget__c}" rendered="{!NOT(editmode)}"/>
<apex:inputField value="{!dummy.budgets.Budget__c}" rendered="{!editmode}" style="height:11px;margin:-1px;width:100px"/>
</apex:column>
<apex:column headerValue="Campaign" id="campaign">
<apex:outputField value="{!dummy.budgets.Advertiser_Campaign__c}" rendered="{!NOT(editmode)}"/>
<apex:selectList value="{!dummy.budgets.Advertiser_Campaign__c}" size="1" rendered="{!editmode}" style="font-size:8px;margin:-1px">
<apex:selectOptions value="{!CampaignOptions}"/>
</apex:selectList>
</apex:column>
<apex:column headerValue="Inventory Type" width="101px">
<apex:outputText value="{!dummy.campaigns.Inventory_Type__c}" rendered="true"/>
</apex:column>
</apex:pageBlockTable>
<apex:outputPanel>
<apex:commandLink value="Allocate" action="{!newCampaignBudget}" reRender="table"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

  

 

I hope this makes sense. Any ideas?

  • January 08, 2012
  • Like
  • 0

Hi everyone,

 

I've been looking everywhere for an answer to this and I can't seem to find it. I would appreciate and help anyone could give me. I have a pageBlockTable on my page that displays a list of records to related to Opportunities. I want this to look as similar to a standard related list as possible. Someone else had a similar problem here. I want the table to look like this:

 



 

But currently it looks like this:

 

 

As you can see, there are a few problems. There is a border underneath the title and buttons, the button is larger than it should be, and the "No records" message doesn't display with a full border around it. In my case, there is also more space between the edge of the pageBlockTable and the pageBlock than there should be.

 

Can anyone point me in the right direction?

 

Jake McCloskey

 

 

  • January 05, 2012
  • Like
  • 0

Hi everyone,  

 

I'm having a tough time figuring this out. I have a modal popup with an inputField and a javascript button that calls an actionFunction to save the object. Unfortunately I can't get the inputField values in the modal to pass to the controller so it won't update. Not sure how to fix this so I came here. Here's the code:

 

//////////
//Page
//////////

<apex:page standardController="Opportunity" extensions="extensionOpportunity" id="pgOpportunity" >

    ///JQuery
    <script src="{!URLFOR($Resource.jQueryDCS,'/js/jquery-1.5.1.min.js')}" type="text/javascript" />
    <script src="{!URLFOR($Resource.jQueryDCS,'/js/jquery-ui-1.8.13.custom.min.js')}" type="text/javascript" />
    <apex:stylesheet value="{!URLFOR($Resource.jQueryDCS,'/css/ui-lightness/jquery-ui-1.8.13.custom.css')}" />

<apex:outputPanel id="modalJQuery">

//Script to bring up modal
<script>
    
    var j$ = jQuery.noConflict();
    
    j$(document).ready(function(){
    
        j$( "#dialog-form" ).dialog({
            autoOpen: false,
            height: 325,
            width: 350,
            modal: true,
            buttons: {

                //This function calls the actionFunction
                "Save": function() {
                    afSaveOpp();
                },
                Cancel: function() {
                    j$( this ).dialog( "close" );
                }
            },
            close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });
    });
    
    function statusShow() {
        j$( "#dialog-form" ).dialog( "open" );
    }
    
    function statusHide() {
        j$( "#dialog-form" ).dialog( "close" );
    }
    
</script>

//The modal popup
<div id="dialog-form" title="Opportunity Edit">
<apex:form >
    <apex:pageBlock mode="maindetail">

        //Field that should be updating
        <apex:inputField value="{!opportunity.Name}" id="inName"/>
    </apex:pageBlock>
</apex:form>    
</div>
</apex:outputPanel>

<apex:outputPanel id="pnlMain">

<apex:form id="frmMain">
    
    //actionFunction that calls save method
    <apex:actionFunction id="afSaveOpp" name="afSaveOpp" action="{!save}" oncomplete="statusHide()">
    </apex:actionFunction>

</apex:form>
</apex:outputPanel>
    
</apex:page>
///////////////
//Controller
///////////////

public with sharing class extensionOpportunity {
    
    public final Opportunity o {get; set;}
    
    public extensionOpportunity(ApexPages.StandardController controller) {
        this.o = (Opportunity)controller.getRecord();
    }
    
    public void doNothing() { }
   
    public void saveOpp() {
        update o;
    }

}

 

I'd appreciate any help in understanding what's going on here.

  • May 09, 2012
  • Like
  • 0

Hi everyone,

 

Sorry if this is a stupid question but here goes. I have a visualforce page that displays a custom table of child objects related to Opportunities and one of the columns is an outputLink to the child object page. The link is based on a lookup field. My page is imbedded in a section of a standard page layout. My problem is that when I click the link, the page I want to redirect to displays in the section in the Opportunity page instead of the full window. 

 

Here is my VF code (unnecessary stuff removed):

 

<apex:page standardController="Opportunity" extensions="AllocateBudgetextension" id="opportunity" showHeader="false" sidebar="false" standardStylesheets="true">
<apex:form >
<apex:pageBlock id="block" mode="maindetail">
<apex:pageBlockSection columns="1">
<apex:outputPanel id="table">

<apex:pageBlockTable value="{!CampaignListDummys}" var="dummy" rendered="{!(CampaignListDummys.size != 0)}" style="margin-bottom:5px">
<apex:column headerValue="Action" width="50px">
<apex:commandLink action="{!removeCampaign}" reRender="table">
<apex:param name="cid" value="{!dummy.budgets.Id}" assignTo="{!dcbid}"/>Remove
</apex:commandLink>
</apex:column>
<apex:column headerValue="Allocation" width="110px">
<apex:outputField value="{!dummy.budgets.Budget__c}" rendered="{!NOT(editmode)}"/>
<apex:inputField value="{!dummy.budgets.Budget__c}" rendered="{!editmode}" style="height:11px;margin:-1px;width:100px"/>
</apex:column>
<apex:column headerValue="Campaign" id="campaign">
<apex:outputField value="{!dummy.budgets.Advertiser_Campaign__c}" rendered="{!NOT(editmode)}"/>
<apex:selectList value="{!dummy.budgets.Advertiser_Campaign__c}" size="1" rendered="{!editmode}" style="font-size:8px;margin:-1px">
<apex:selectOptions value="{!CampaignOptions}"/>
</apex:selectList>
</apex:column>
<apex:column headerValue="Inventory Type" width="101px">
<apex:outputText value="{!dummy.campaigns.Inventory_Type__c}" rendered="true"/>
</apex:column>
</apex:pageBlockTable>
<apex:outputPanel>
<apex:commandLink value="Allocate" action="{!newCampaignBudget}" reRender="table"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

  

 

I hope this makes sense. Any ideas?

  • January 08, 2012
  • Like
  • 0