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
Thiruchuri AdityanThiruchuri Adityan 

Rerender in fields

I have two fields Opportunity(Lookup) and Product(Picklist).  On selection of Opportunity the Product field is to be rerender i.e., basing on the input of opportunity only products assigned to that opportunity should only be shown..
Gaurav NirwalGaurav Nirwal
<apex:outputPanel id="header01"  layout="block" styleClass="pbHeader">           
                 <table class="detailList" cellspacing="0" cellpadding="0" border="0">                          
                    <tr>
                       <td class="labelCol">{!$ObjectType.DomaineMarque__c.fields.Name.label}</td>
                        <td class="dataCol" style="width:70%">
                             <div class="requiredInput">
                                <div class="requiredBlock"></div>
                                 <apex:selectList id="dom" value="{!selectedDomaine}" size="1" onchange="RefreshHeader();">
                                      <apex:selectOptions value="{!DomaineList}"/>
                                 </apex:selectList>
                                 <apex:actionFunction name="RefreshHeader" immediate="true" action="{!Refresh}" rerender="header01" status="myStatus" />
                              </div>
                          </td>
                    </tr>
                    <tr style="display:{!IF(selectedDomaine == 'new','','none')}">
                        <td class="labelCol">{!$ObjectType.DomaineMarque__c.fields.Type__c.label}</td>
                        <td class="dataCol"><apex:inputfield value="{!domaine.Type__c}" /></td>
                    </tr>
                    <tr style="display:{!IF(selectedDomaine == 'new','','none')}">
                        <td class="labelCol">{!$ObjectType.DomaineMarque__c.fields.Article__c.label}</td>
                        <td class="dataCol"><apex:inputfield value="{!domaine.Article__c}"/></td>
                    </tr>
                    <tr style="display:{!IF(selectedDomaine == 'new','','none')}">
                        <td class="labelCol">{!$ObjectType.DomaineMarque__c.fields.Nom__c.label}</td>
                        <td class="dataCol"><apex:inputfield value="{!domaine.Nom__c}" required="true"/></td>
                    </tr> 
                </table>         
           </apex:outputPanel>
Gaurav NirwalGaurav Nirwal
<apex:actionRegion immediate="true">
<apex:pageBlockSection columns="2" title="Information" id="jobtrackerDetailPbs">


<apex:pageBlockSectionItem>
<apex:outputLabel value="Process Name"> </apex:outputLabel>
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputfield id="ProcessName" value="{!Process_Name__c}" label="Process Name" />
</apex:outputPanel>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem>
<apex:outputLabel value="Location"> </apex:outputLabel>
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputfield id="Location1" value="{!Location__c}" />
</apex:outputPanel>
</apex:pageBlockSectionItem>

</apex:pageBlockSection
</apex:actionRegion>
Gaurav NirwalGaurav Nirwal
If my problem can solves your problem Please select as best answer
Thiruchuri AdityanThiruchuri Adityan

<apex:actionRegion >
                        <apex:inputField value="{!lineitem.OpportunityId}" >
                        <apex:actionsupport event="onChange" action="{!getprods}" reRender="thePanel"/>
</apex:actionRegion>
<apex:selectList value="{!lineitem.custom__c}" size="1" id="thePanel">
                            <apex:selectOptions value="{!prods}">
                        </apex:selectOptions>
                        </apex:selectList>

and my controller is

public List<selectOption> getprods()
     {
            List<selectOption> options = new List<selectOption>();
            opp = [select PriceBook2Id from Opportunity where Id=:lineitem.OpportunityId];
            System.debug('sample'+opp);
            for (PriceBookEntry product : [SELECT Name from PriceBookEntry where PriceBook2Id=:opp.PriceBook2Id])
            {
                options.add(new selectOption(product.Name, product.Name));
            }
                return options;
  }

For an existing product it is working.  But for a newly created record the page is not even opening and throwing an error "List has no rows for assignment to SObject"