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
pradyprady 

VF page help

Hi,

 

I am trying to load values into VF input box  based on the account selected from popup.

 

 

              <apex:pageBlockSectionItem id="pageblocksectionitem5">
<apex:outputLabel value="Account Name"></apex:outputLabel>
<apex:panelGroup style="border: 0px solid Blue;" >
<apex:outputPanel layout="inline" style="background-color:#CC0000; padding-left: 3px; position: absolute; margin-left: 0px; margin-top: 2px; margin-right: 0px; height: 20px; border: 0px Red; " ></apex:outputPanel>
<input type="text" name="AccountName" id="Input12" style="margin-left: 5px; " /><img src="/s.gif" class="lookupIcon" onClick='window.open("/apex/xyz,"width=600,height=400,left=150,top=200,toolbar=1,status =1,");'/>
</apex:panelGroup>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem id="pageblocksectionitem3">
<apex:outputLabel value="Linea"></apex:outputLabel>
<apex:outputLabel value="{!linea}"></apex:outputLabel>
</apex:pageBlockSectionItem>

I need to populate linea from  the custom field linea__c which is from Account object.. I can query to get the field value. But i need it to happen immediately after the account is selected. How can i do it?

 

Any pointers would be great...

 

Thanks

 

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
John De SantiagoJohn De Santiago

Based on the markup you have below it looks like you have created your own lookup screen. If that is the case what you can do is create some javascript on the visualforce page that you can call from your popup. When the user selects the account from the popup you would then call your javascript from the opener page:

 

For instance:

 

<a href="javascript&colon;window.opener.selectAccount('accountId'); window.close();">Account Name</a>

 

Assuming that you are using a link similar to the way native lookups work you would call the javascript. Then in the selectAccount method you can do your lookup using an action:function to do the lookup and refresh the page. 

 

There are actually a couple of different techniques that can be used but this is what comes to mind given what I understand of what you are trying to do. If you provide some more details about the page and popup I might be able to help guide you further.

All Answers

bob_buzzardbob_buzzard

When the account selection is made, presumably you populate the account inputtext component via Javascript from the popup window?

 

If so, you can invoke an apex:actionFunction to execute an action method on the controller and re-render the components you are interested in.  The controller action method will set up the linea property based on the selected account.

John De SantiagoJohn De Santiago

Based on the markup you have below it looks like you have created your own lookup screen. If that is the case what you can do is create some javascript on the visualforce page that you can call from your popup. When the user selects the account from the popup you would then call your javascript from the opener page:

 

For instance:

 

<a href="javascript&colon;window.opener.selectAccount('accountId'); window.close();">Account Name</a>

 

Assuming that you are using a link similar to the way native lookups work you would call the javascript. Then in the selectAccount method you can do your lookup using an action:function to do the lookup and refresh the page. 

 

There are actually a couple of different techniques that can be used but this is what comes to mind given what I understand of what you are trying to do. If you provide some more details about the page and popup I might be able to help guide you further.

This was selected as the best answer