• akarwa
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hi

 

I have created a custom list button which opens the VF page associatede with it and and I get the handle of selected records in the new VF page using StandardSetController which works fine. But the requirement is that the VF page should open up in the new window, not in same window. How to do that?

One way i did was by using javascript openWindow and pass the VF page URL, but the problem is that I am not able to get the handle of the selected records in the VF page.

 

What is the best way to pass the selected records to Visual force page using javascript.? or is there any alternate way to open up the VF page in new window

 

Thanks in Advance

  • December 27, 2011
  • Like
  • 0

Hi,

 

 

I am trying to display a message when checbox in my Visual force page is checked. I am using action support for my check box component. The re rendering part the section is working, but the set property of the checkbox  is not getting invoked i.e. I am not able to capture the checkbox value if its checked or unchecked.

 

Below is my source code. Thanks in advance

 

Controller

 

public Boolean specialInvest{

      get{

            if(specialInvest == null){

                  specialInvest = true;

            }

                       

            return specialInvest;  

      }

      set;

    }

 

 

Visual Force page

 

<apex:page standardController="Case" extensions="RMAEditPageController" action="{!pageLoad}">     
<script>


    var windowRef;
    var intervalId = 0;
    var globalObj;
    function openLookUpWindow(obj){
        //alert(obj);  
        var ele = document.getElementById(obj);
        var accId = document.getElementById("j_id0:rmaForm:block:RMASection:AccountNameItem:AccountName_lkid").value;
        //alert(accId);
        checkToOpenWindow(accId)
        //setTimeout(checkToOpenWindow, 2*1000);
    }
   
    function checkToOpenWindow(accountId){
        windowRef = window.open('/apex/lookUp?id='+accountId,'','width=500, height=300, scrollbars=yes, resizable=yes, menubar=no, status=no,toolbar=no');
        //checkWindowStatus();
    }
               
              
</script>
  <apex:form id="rmaForm" >
        <apex:pageMessages />
        <apex:pageBlock mode="edit" id="block" rendered="true" >
                <apex:pageBlockButtons location="both">
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!saveAdd}" value="Save & Add or Mass Upload RMA Item"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
        </apex:pageBlockButtons>
           
            <apex:pageBlockSection id="RMASection" title="RMA" columns="2" >
                <apex:pageBlockSectionItem id="AccountNameItem">
                    <apex:outputLabel for="AccountName">Account Name</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField required="true" id="AccountName" value="{!Case.AccountID}" />
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="ReturnTypeItem">
                    <apex:outputLabel for="ReturnType">Return Type</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField required="true" id="ReturnType" value="{!Case.Return_Type__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

                <apex:pageBlockSectionItem id="ShipToItem">
                    <apex:outputLabel for="ShipTo">Ship To</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputText value="{!shipToNum}" id="ShipTo" onclick="javascript&colon;openLookUpWindow('{!$Component.RMASection}');" >
                        </apex:inputText>
                        <apex:commandButton reRender="ShipTo" action="{!lookUp}"  image="{!$Resource.lookupIcon}"  onclick="javascript&colon;openLookUpWindow('{!$Component.RMASection}');"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="InvoiceToItem">
                    <apex:outputLabel for="InvoiceTo">Invoice To</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="InvoiceTo"  value="{!Case.Invoice_To1__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
                               
                <apex:pageBlockSectionItem id="CustomerPOItem">
                    <apex:outputLabel for="CustomerPO">Customer PO</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="CustomerPO"  value="{!Case.Customer_PO__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="ContactNameItem">
                    <apex:outputLabel for="ContactName">Contact</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="ContactName"  value="{!Case.ContactID}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                 <apex:pageBlockSectionItem id="DescriptionItem">
                    <apex:outputLabel for="Description">Description</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="Description"   value="{!Case.Description}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="SpecialInvestigationItem">
                    <apex:outputLabel for="SpecialInvestigation">Special Investigation</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputCheckbox id="SpecialInvestigation"   value="{!specialInvest}">
                            <apex:actionSupport event="onclick" reRender="note"/>
                        </apex:inputCheckBox>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

               
                 <apex:pageBlockSectionItem id="StatusItem">
                    <apex:outputLabel for="Status">Status</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:outputField id="Status"  value="{!Case.Status}" />
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

                </apex:pageBlockSection>
           
                           
                <apex:pageBlockSection title="Order Numbers" columns="2" id="OrderNumberSection">
                <apex:pageBlockSectionItem id="OrderNumberItem">
                    <apex:outputLabel for="OrderNumber">Order Number</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="OrderNumber"  value="{!Case.Original_Order_Number__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

                 <apex:pageBlockSectionItem id="OrderLineNumberItem">
                    <apex:outputLabel for="OrderLineNumber">Order Line Number</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="OrderLineNumber"  value="{!Case.Original_Order_Line_Number__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
              </apex:pageBlockSection>
              </apex:pageBlock>
              <apex:pageBlock id="note">
                  <apex:pageMessages id="msg" rendered="{!specialInvest}"></apex:pageMessages>
              </apex:pageBlock>
          </apex:form>   
</apex:page>

 

 

 

  • December 23, 2010
  • Like
  • 0

Hi,

 

 

I am trying to display a message when checbox in my Visual force page is checked. I am using action support for my check box component. The re rendering part the section is working, but the set property of the checkbox  is not getting invoked i.e. I am not able to capture the checkbox value if its checked or unchecked.

 

Below is my source code. Thanks in advance

 

Controller

 

public Boolean specialInvest{

      get{

            if(specialInvest == null){

                  specialInvest = true;

            }

                       

            return specialInvest;  

      }

      set;

    }

 

 

Visual Force page

 

<apex:page standardController="Case" extensions="RMAEditPageController" action="{!pageLoad}">     
<script>


    var windowRef;
    var intervalId = 0;
    var globalObj;
    function openLookUpWindow(obj){
        //alert(obj);  
        var ele = document.getElementById(obj);
        var accId = document.getElementById("j_id0:rmaForm:block:RMASection:AccountNameItem:AccountName_lkid").value;
        //alert(accId);
        checkToOpenWindow(accId)
        //setTimeout(checkToOpenWindow, 2*1000);
    }
   
    function checkToOpenWindow(accountId){
        windowRef = window.open('/apex/lookUp?id='+accountId,'','width=500, height=300, scrollbars=yes, resizable=yes, menubar=no, status=no,toolbar=no');
        //checkWindowStatus();
    }
               
              
</script>
  <apex:form id="rmaForm" >
        <apex:pageMessages />
        <apex:pageBlock mode="edit" id="block" rendered="true" >
                <apex:pageBlockButtons location="both">
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!saveAdd}" value="Save & Add or Mass Upload RMA Item"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
        </apex:pageBlockButtons>
           
            <apex:pageBlockSection id="RMASection" title="RMA" columns="2" >
                <apex:pageBlockSectionItem id="AccountNameItem">
                    <apex:outputLabel for="AccountName">Account Name</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField required="true" id="AccountName" value="{!Case.AccountID}" />
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="ReturnTypeItem">
                    <apex:outputLabel for="ReturnType">Return Type</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField required="true" id="ReturnType" value="{!Case.Return_Type__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

                <apex:pageBlockSectionItem id="ShipToItem">
                    <apex:outputLabel for="ShipTo">Ship To</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputText value="{!shipToNum}" id="ShipTo" onclick="javascript&colon;openLookUpWindow('{!$Component.RMASection}');" >
                        </apex:inputText>
                        <apex:commandButton reRender="ShipTo" action="{!lookUp}"  image="{!$Resource.lookupIcon}"  onclick="javascript&colon;openLookUpWindow('{!$Component.RMASection}');"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="InvoiceToItem">
                    <apex:outputLabel for="InvoiceTo">Invoice To</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="InvoiceTo"  value="{!Case.Invoice_To1__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
                               
                <apex:pageBlockSectionItem id="CustomerPOItem">
                    <apex:outputLabel for="CustomerPO">Customer PO</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="CustomerPO"  value="{!Case.Customer_PO__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="ContactNameItem">
                    <apex:outputLabel for="ContactName">Contact</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="ContactName"  value="{!Case.ContactID}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                 <apex:pageBlockSectionItem id="DescriptionItem">
                    <apex:outputLabel for="Description">Description</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="Description"   value="{!Case.Description}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
               
                <apex:pageBlockSectionItem id="SpecialInvestigationItem">
                    <apex:outputLabel for="SpecialInvestigation">Special Investigation</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputCheckbox id="SpecialInvestigation"   value="{!specialInvest}">
                            <apex:actionSupport event="onclick" reRender="note"/>
                        </apex:inputCheckBox>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

               
                 <apex:pageBlockSectionItem id="StatusItem">
                    <apex:outputLabel for="Status">Status</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:outputField id="Status"  value="{!Case.Status}" />
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

                </apex:pageBlockSection>
           
                           
                <apex:pageBlockSection title="Order Numbers" columns="2" id="OrderNumberSection">
                <apex:pageBlockSectionItem id="OrderNumberItem">
                    <apex:outputLabel for="OrderNumber">Order Number</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="OrderNumber"  value="{!Case.Original_Order_Number__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>

                 <apex:pageBlockSectionItem id="OrderLineNumberItem">
                    <apex:outputLabel for="OrderLineNumber">Order Line Number</apex:outputLabel>
                    <apex:panelGroup >
                        <apex:inputField id="OrderLineNumber"  value="{!Case.Original_Order_Line_Number__c}"/>
                    </apex:panelGroup>
                </apex:pageBlockSectionItem>
              </apex:pageBlockSection>
              </apex:pageBlock>
              <apex:pageBlock id="note">
                  <apex:pageMessages id="msg" rendered="{!specialInvest}"></apex:pageMessages>
              </apex:pageBlock>
          </apex:form>   
</apex:page>

 

 

 

  • December 23, 2010
  • Like
  • 0