0

"A" is a picklist field.

"B" is a just a text field.

I used action support component in the VF page.Bascially on change of a "A" field rendered "B" field.Functionality is working fine as per the code but the when ever I try to select any value in the "A" field the page is flickering the page is going up.

VF code-->

                <c:TFormFields id="otherid2" label="2"   >
                        <apex:inputField styleClass="form-control"  value="{!Location__c.Material_Type2__c}">
                        <apex:actionSupport event="onchange"  rerender="otherid2" onsubmit="changemattype(2);" oncomplete="window.scrollTo(0,2200);" /> 

                   </apex:inputField>

                    <apex:inputField styleClass="form-control" value="{!Location__c.Other_Material_Types_2__c}" rendered="{!IF( Location__c.Material_Type2__c == 'Other', true, false )}"/>              

                    </c:TFormFields>

javascript function--->

   function changemattype(e){

        $("#mat"+e).find("textarea").val("");
    }
3
  • can you add your mockup Jul 20, 2017 at 22:16
  • 1
    Add a rerender attribute to your action support. To be more specific we will need to see code
    – Eric
    Jul 20, 2017 at 23:51
  • I added the code.
    – SFDC
    Jul 21, 2017 at 0:45

1 Answer 1

0

I think there is an issue with rerendering, here is an example of correctly working code from my DE:

Visualforce

<apex:page id="ActionSupportTest" controller="ActionSupportController2">
    <apex:form >
        <apex:outputPanel id="vendor2">
            <p><b>Vendor:</b></p>
            <apex:selectList value="{!vendor}" multiselect="False" size="1" onclick="rerender">
                <apex:actionSupport event="onchange" rerender="otherPanel,values" action="{!specifyVendor}"/>
                <apex:selectOptions value="{!vendors}"/>
            </apex:selectList><p/>
        </apex:outputPanel>
        <br/>
        <apex:outputPanel id="otherPanel">
            <apex:inputText value="{!otherVendor}" rendered="{!vendor=='Other'}"> Other: </apex:inputText>
        </apex:outputPanel>
        <br></br>
        You have selected:&nbsp;
        <apex:outputText value="{!displaySelectedText}" label="You have selected:" id="values" />  
    </apex:form>
</apex:page>

Controller

public with sharing class ActionSupportController2 {
 public String vendor {get; set;}//Vendor Name
 public String otherVendor {get; set;}//Vendor Name
 public string displaySelectedText {get;set;}

     public List<SelectOption> getVendors(){
         System.debug('getVendors');    
         List<SelectOption> options = new List<SelectOption>();
         options.add(new SelectOption('Cisco','Cisco'));
         options.add(new SelectOption('Alcatel','Alcatel'));
         options.add(new SelectOption('Tibco','Tibco'));
         options.add(new SelectOption('Other','Other'));
         return options;
     }

     public PageReference specifyVendor(){
        displaySelectedText  = vendor;
        System.debug(vendor);
        return null;
    }
 }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .