• Kavya Neelagiri
  • NEWBIE
  • 0 Points
  • Member since 2016

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

Hi all. 

 

I am working on customizing the quote object to better serve our business needs.  I've added some custom fields to the QuoteLineItem object, Maximum_Volume__c, Minimum_Quantity__c, and Expiration_Date__c.  Each line item will have a value in only one of these fields, but not necessarily the same field. 

 

I'm defining the rendered value based on a PickList Value and updating the VF page using actionSupport.  The VisualForce page works fine, except when the page posts the values entered in the respective fields are not passed to the controller.  If I force a second action on the page(I pushing a command button that doesn't do anything), the second time the values are passed to the controller so I toyed around a little bit....

 

If I reRender the entire pageBlockSection with my actionSupport method, the values post to the controller as I would expect.  The problems with this is that for each line item, I have to select a values from the picklist and and then all of my input fields are cleared.

 

It seems my issue has something to do with the way I am causing the fields to be rendered, but I don't know how to get around it.  I am using a controller extension, but the page uses the standard getters and setters for the quoteLineItems.

 

I would appreciate any suggestions

 

<apex:page standardController="Quote" extensions="newQuoteExt" recordSetVar="OpportunityLineItems" id="page">
  <apex:sectionHeader title="Quote" subtitle="New Special Pricing Agreement"/> 
  <style type="text/css">
        .exceptionText { font-style:italic; font-weight:bold; color:red;}
  </style>
  <apex:messages styleClass="exceptionText"/>
  
  <apex:form >  
    <apex:pageBlock id="block" >
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!Save}"/>
        <apex:commandButton value="Cancel" action="{!Cancel}"/>
         <apex:commandButton value="test" action="{!updateAgreementType}"/>
      </apex:pageBlockButtons>
      
      <apex:pageBlockSection title="Quote Information">
        <apex:inputField value="{!theQuote.Name}"/>
        <apex:inputField value="{!theQuote.Status}"/>
        <apex:outputField value="{!opportunity.Name}"/>
        <apex:outputField value="{!opportunity.Account.Name}"/>
        <apex:inputField value="{!theQuote.Description}"/>
      </apex:pageBlockSection>
      <apex:actionRegion >
      <apex:pageBlockSection title="Customer Information" id="custinfo">
        <apex:inputField value="{!theQuote.ContactId}"  id="contact">
          <apex:actionSupport action="{!updateContact}" event="oncomplete" reRender="custinfo"/>
        </apex:inputField>
        <apex:inputField value="{!theQuote.Phone}" id="phone">
          <apex:actionSupport action="{!updateContact}" event="onchange" reRender="custinfo"/>
        </apex:inputField>
        <apex:inputField value="{!theQuote.Email}" id="email"/>
        <apex:inputField value="{!theQuote.Fax}" id="fax"/>
 

      </apex:pageBlockSection> 
      </apex:actionRegion>
      <apex:pageBlockSection title="Address Information">
        <apex:inputField value="{!theQuote.BillingName}"/>
        <apex:inputField value="{!theQuote.ShippingName}"/>
        <apex:inputField value="{!theQuote.BillingStreet}"/>
        <apex:inputField value="{!theQuote.ShippingStreet}"/>
        <apex:inputField value="{!theQuote.BillingState}"/>
        <apex:inputField value="{!theQuote.ShippingState}"/>
        <apex:inputField value="{!theQuote.BillingPostalCode}"/>
        <apex:inputField value="{!theQuote.ShippingPostalCode}"/>
        <apex:inputField value="{!theQuote.BillingCountry}"/>
        <apex:inputField value="{!theQuote.ShippingCountry}"/>
      
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Product Information" columns="1" id="productsection">
        <apex:pageBlockTable value="{!lineItems}" var="item" columnsWidth="25%,25%,25%">
          
          <apex:column headerValue="Product">
            <apex:outputField value="{!item.PriceBookEntry.ProductCode}"/>
          </apex:column>
          
          <apex:column headerValue="Agreement Type" colspan="2" id="test">
            <apex:dataTable value="{!item}" var="type">
              <apex:column >
               
<!- THIS IS THE AREA GIVING ME TROUBLE -- >
 <apex:actionRegion >
                  <apex:inputField value="{!item.Agreement_Type__c}" required="true">
                    <apex:actionSupport event="onchange" action="{!updateAgreementType}" reRender="test"/>
                  </apex:inputField> 
                </apex:actionRegion>
              </apex:column>
              <apex:column id="test">
              <apex:inputField value="{!item.Maximum_Volume__c}" rendered="{!IF(item.Agreement_Type__c='Maximum Volume',true,false)}" required="{!IF(item.Agreement_Type__c='Maximum Volume',true,false)}" id="max"></apex:inputField> 
              <apex:inputField value="{!item.Minimum_Quanitity__c}" rendered="{!IF(item.Agreement_Type__c='Minimum Quantity',true,false)}" required="{!IF(item.Agreement_Type__c='Minimum Quantity',true,false)}" id="min"> </apex:inputField> 
              <apex:inputField value="{!item.Expiration_Date__c}" rendered="{!IF(item.Agreement_Type__c='Expiration Date',true,false)}" required="{!IF(item.Agreement_Type__c='Expiration Date',true,false)}" id="date">  </apex:inputField>
             
              </apex:column>
            </apex:dataTable>
 
           </apex:column>
<! -- --------------------------------------------- END -->
          <apex:column headerValue="Special Price" >
            <apex:outputField value="{!item.UnitPrice}" id="outPut">
              <apex:inlineEditSupport event="dblclick" />
            </apex:outputField>
          </apex:column>

        </apex:pageBlockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>

   </apex:form>
</apex:page>

 

  • July 13, 2011
  • Like
  • 0