3

I posted same question here https://stackoverflow.com/questions/17260701/passing-values-to-nested-apex-page-for-editing/17289978?noredirect=1#17289978

I followed the solution but getting error while accessing object is Page 2.

This is what I have done:

Page 1:

I have this command button in pageblocktable column

<apex:commandLink reRender="catTable" title="Modify" action="editBuilding" > <apex:param name="bIdModifyParam" value="{!item.id}" assignTo="{!selectedrowId}"/> </apex:commandLink>

On click of button showing this dialog with javascript:

    <div class="popupMain clearfix"> 
   <apex:include pageName="Page2"/> 
    </div> 

Page 1 Controller extension:

public PageReference editBuilding() { 
      for(Object__c obj : Rows)
  { 
     if(obj.Id==selectedrowId){ 
        objbuilding= obj; } 
   } 
   return null; 
 }

Page 2:

<apex:inputField value="{!objbuilding.Id}"/>  
//This line throws error saying objbulding not found
2
  • Have you defined objbuilding in your controller? Try adding object__c objbuilding ; in your controller
    – Prady
    Jun 29, 2013 at 6:06
  • This could be of some help tehnrd.com/visualforce-pop-up
    – Prady
    Jun 29, 2013 at 9:08

1 Answer 1

1

Page 2 needs a controller as well, even if you use the same one it will not share the value in objBuilding.

Your best bet would be to rerender the section of the page with the div popup when the button is clicked, and pass the ID as a parameter. You could then check the parameter in a controller for page 2, or you could just pass the parameter using the name "id" and use a standard controller for page 2.

6
  • I thought we could share data across two pages using same controller. salesforce.stackexchange.com/questions/12696/…
    – Prady
    Jun 29, 2013 at 7:30
  • You're right - isn't there something specific you have to do to support that?
    – Matt Lacey
    Jun 29, 2013 at 7:39
  • ofcourse, there are.. I totally agree with your suggestion of rerendering of div popup which i think is best suited for the need of the @sanjivani instead of going for 2 VF pages
    – Prady
    Jun 29, 2013 at 8:33
  • @Prady, objbuilding is declared in page1 controller. I tried to have page 2 content in page 1 inside div, but id is not being passed on click of the button. I am rendering div itself on button click. LaceySnr, Page2 uses standard controller so i cant have objbuilding declared in page 2 controller since it is not custom controller.
    – Sanjivani
    Jun 29, 2013 at 13:55
  • @Sanjivani for the issue of you not able to pass parameter, you can check this forums.sforce.com/t5/forums/forumtopicprintpage/board-id/…
    – Prady
    Jun 30, 2013 at 4:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.