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
enossirenossir 

Conditional rendering on VF page based on a variable which is a record ID number from controller

Now i have a text field called Other__c that needs to display if a related lookup value is selected the Symptoms__c field. The reason the Symptoms__c field is a lookup field is because the values in that field are related to a seperate lookup called Machine__c...that's not important. But every machine has a related "Other" Symptoms__c record.

How it currently works is when you select a machine the page refreshes and loads the corresponding values of the Symptoms. 

12:59:39:038 USER_DEBUG [95]|DEBUG|
(System.SelectOption[value="a1K2a000000CgJcEAK", label="Configuration", disabled="false"],
 System.SelectOption[value="a1K2a000000k5sYEAQ", label="Other", disabled="false"])

for example if i selected machine test i'd get these two possible selections. 

Now after i select Other as the symptom i was the Other__c field to display on the VF page. 

Currently i have a mess of VF, method and JS just to get the machine-->symptoms to work but that's because it's reloading a related list and having it display as a picklist. I feel like this one should be easymoney because it's just a if value is selected on the page then render.



 
enossirenossir
Is there anyway to do 

apex:actionSupport event = "onChange" 

then if label = other rerender="Other1"
enossirenossir
<apex:page standardController="Case"  extensions="SVC_TicketResolve_Ctl" showHeader="true" standardStylesheets="true" sidebar="true" applyHtmlTag="true" applyBodyTag="false">
    <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">
        <head>
        <apex:outputPanel rendered="{!objCase.RecordType.DeveloperName=='Systems_Service_Request'}">
            <script src="https://code.jquery.com/jquery-1.10.2.js"></script>                    
            <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
            </apex:outputPanel>
            <meta charset="utf-8" />
            <meta http-equiv="x-ua-compatible" content="ie=edge" />
            <meta name="viewport" content="width=device-width, initial-scale=1" />
            <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>

            <apex:slds />
            
            <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/>
            <link rel="stylesheet" href="{!URLFOR($Resource.Bootstrapdist,'/css/bootstrap-select.css')}"/>
            <link rel="stylesheet" href="{!URLFOR($Resource.ajaxbootstrapdist,'/css/ajax-bootstrap-select.css')}"/>
            
            <script src="{!URLFOR($Resource.Bootstrapdist,'/js/bootstrap.min.js')}"></script>
            <script src="{!URLFOR($Resource.Bootstrapdist,'/js/bootstrap-select.js')}"></script>
            <script src="{!URLFOR($Resource.ajaxbootstrapdist,'/js/ajax-bootstrap-select.js')}"></script>
            <script src="{!URLFOR($Resource.SVC_FDWTicketSearch,'/TicketResolve.js')}"></script>

            <script type="text/javascript">
                
                var j$ = jQuery.noConflict();
                var ticketObjects;
                var queryTerm;                               
                var previousValSystems = '';
                var previousValProduct = '';
                var previousValFeatureFunction = '';
                var previousValChangeReq = '';
                
                j$(document).ready(function(){                    
                    
                    //On click hide page messages     
                    j$("#myCustomMessage").on("click",function(e){
                        j$(this).hide();
                    });
                    j$(document).on("click",function(e){
                        if(e.target){
                            j$('[id$=msgID]').hide();
                        }
                    });
                    //Tony R
                    //Set picklist values if System, Product or Change request already exists
                    var selSystemId = '{!selSystemId}';
                    var selProductId = '{!selProductId}';
                    var selFeatureFunctionId = '{!selFeatureFunctionId}';
                    var selCRId = '{!selChangeReqId}';
                   
                    if(selSystemId)
                        j$('[id$="drpSystem"]').selectpicker('val',selSystemId);
                    if(selProductId)
                        j$('[id$="drpProduct"]').selectpicker('val',selProductId);
                    if(selFeatureFunctionId)
                        j$('[id$="drpFeatureFunction"]').selectpicker('val',selFeatureFunctionId);
                    if(selCRId)
                        j$('[id$="drpCRId"]').selectpicker('val',selCRId);

                    attachEvents();

                    //Format error messages
                    j$('.messageTable li').each(function(){
                        var msg = j$(this).text();
                        j$(this).text(msg.replace('Validation Error: Value is required.','You must enter a value'));
                    });
                }); 


                //Reload all picklist after finish
                function reloadPicklist(){
                    refereshSelectPicker('Systems');
                    refereshSelectPicker('Product');
                    refereshSelectPicker('FeatureFunctions')
                    refereshSelectPicker('ChangeRequest');            
                }

                //Navigate to New problem page
                function openSearchAndLinkProblem1(){
                    window.open('/apex/SVC_Problem_Incident?id={!objCase.Id}&source=SVC_Problem__c&type=ticket' , '_blank', 'toolbar=0,location=0,menubar=0');
                }

                //Navigate to create and link problem page
                function createAndLinkProblem1(){
                    
                    //Get selected Product & System Id
                    
                    var p = j$('[id$=drpProduct]').val();
                    var s = j$('[id$=drpSystem]').val();
                    

                    window.open('/apex/SVC_ProblemPage?ticketId={!objCase.Id}&System='+s+'&Product='+p+'&sub={!objCase.Subject}&imp={!objCase.Impact__c}&urg={!objCase.Urgency__c}','_blank', 'toolbar=0,location=0,menubar=0,width=800,height=600');
                    
                }
            </script>
            
            
            <style>
                html{font-size:100%;}
                body{margin:8px;}
                .dateFormat{display:none;}
                .placeHolder{color:#999 !important;}
                .ui-widget{font-family:inherit;font-size:inherit;}
                .ui-widget-content{background:inherit;border:1px solid #d8dde6;}
                .ui-state-focus, .ui-widget-content .ui-state-focus{background:inherit;border:inherit;color:inherit;}
                .ui-widget-content a{color:inherit;text-decoration:inherit;display:block;}
                .ui-autocomplete {
                    max-height: 236px;
                    overflow-y: auto;
                    /* prevent horizontal scrollbar */
                    overflow-x: hidden;
                }
                
                /* CSS for Account lookup */
                .lookupInput a{
                    position: absolute;
                    width: 30px !important; 
                    margin-left: 3px;
                    background-image: url(/img/setup/search-icon.png) !important;
                    background-repeat: no-repeat !important;
                    background-position: center !important;
                  display: inline-flex !important;
                }
                .lookupInput input{
                    width:91% !important;
                }
                .lookupInput a img{
                    display:none !important;
                }

                .tertiaryPalette{
                    background-color:#222 !important;
                }
                h3{
                    display: inline !important;
                }
                .confirmM3 {
                    float:left ;
                    width:100% ;
                }
                .errorM3{
                    float:left ;
                    width:100% ;
                }
                .errorMsg{display:none;}                
            </style>    
            
        </head>
        <apex:form id="myForm">
            <body>
                <div class="slds-scope">
                    <apex:pageMessages id="msgID"/>
                    
                    <div class="slds-box slds-theme--alt-inverse" style="float:left;width:100%;">
                        <p style="float:left">Ticket Information</p>
                        <span style="float: right;"></span>
                    </div>
                    <br/>
                    
                    <apex:actionFunction name="openTicketDetail" action="{!openTicketDtls}"  status="actionStatusID"/>
                    <div class="mainDiv" style="width:100%;">   
                    <div class="slds-form-element" >
                            <label class="slds-form-element__label" style="font-size: 110%;" for="text-input-01"><b>Account Name</b></label>
                            <apex:outputText styleClass="slds-form-element__static" value="{!objCase.Account.Name}" /><br/>
                            <label class="slds-form-element__label" for="text-input-01">Contact</label>
                            <apex:outputText styleClass="slds-form-element__static" value="{!objCase.Contact.Name}" label="Contact"/><br/>
                            <label class="slds-form-element__label" for="text-input-01">Ticket Number</label>
                            <a href="javascript:void(0);" onclick="openTicket();" class="slds-text-link--reset"><span class="slds-text-link">{!objCase.CaseNumber}</span>.</a>
                        </div>
                    
                    <!-----------System Incident Section --Start ------------------------------------------>
                    <apex:outputPanel id="IncidentPanelId" rendered="{!objCase.RecordType.DeveloperName=='Systems_Incident'}">
                    <div class="section1" style="width: 33%;float:left;margin-right: 3.5%;">
                        <div class="slds-form-element" style="margin-top: 1%;margin-left: 6%;">
                            <label class="slds-form-element__label" style="margin-top: 1%;" for="text-input-01">
                            <abbr class="slds-required" style="color: red;" title="required">*</abbr> System :</label>
                          
                            <div class="slds-form-element slds-lookup" data-select="single">
                                <div class="slds-form-element__control" style="width: 94%;">
                                    <div class="slds-input-has-icon slds-input-has-icon--right">
                                        <apex:actionRegion >
                                        <apex:outputPanel id="Systems1">                             
                                            <apex:selectList label="System" required="true" id="drpSystem" value="{!selSystemID}" html-data-live-search="true" styleClass="selectpicker show-tick form-control" html-data-actions-box="true" html-data-done-button="true">
                                                <apex:selectOption html-data-hidden="true" itemValue="" itemLabel="Nothing Selected"/>
                                                <apex:selectOptions value="{!Systems}"/>
                                        
                                            </apex:selectList>
                                        </apex:outputPanel>
                                        <apex:actionFunction name="refreshSystemInfo" action="{!getSystemInfo}" rerender="Product1,ceDate,msgID" oncomplete="refereshSelectPicker('Product')" status="actionStatusID"/>
                                        </apex:actionRegion>
                                       
                                        
                                    </div>
                                </div>
                            </div>
                            
                            <label class="slds-form-element__label" for="text-input-01">
                            <abbr class="slds-required" style="color: red;" title="required">*</abbr> Product :</label>
                            <div class="slds-form-element slds-lookup" data-select="single">
                                <div class="slds-form-element__control" style="width: 94%;">
                                    <div class="slds-input-has-icon slds-input-has-icon--right">
										<apex:actionRegion>
                                        <apex:outputPanel id="Product1">                             
                                            <apex:selectList label="Product" required="true" id="drpProduct" value="{!selProductId}" html-data-live-search="true" styleClass="selectpicker show-tick form-control" html-data-actions-box="true" html-data-done-button="true">
                                                <apex:selectOption html-data-hidden="true" itemValue="" itemLabel="Nothing Selected"/>
                                                <apex:selectOptions value="{!Products}"/>
                                            </apex:selectList>
                                        </apex:outputPanel> 
                                         <apex:actionFunction name="refreshProductInfo" action="{!getProductInfo}" rerender="FeatureFunction1" oncomplete="refereshSelectPicker('FeatureFunctions')" status="actionStatusID"/>
                                        </apex:actionRegion> 
                                     </div>
                                </div>
                            </div>
                             
                            
                            
                          
                         
                            <label class="slds-form-element__label" for="textarea-input-01">
                            <abbr class="slds-required" style="color: red;" title="required">*</abbr> Resolution :</label>
                            <div class="slds-form-element__control">
                                <apex:inputField required="true" styleClass="slds-textarea slds-required" value="{!objCase.Solution__c}" label="Resolution"/>
                            </div>
                            
                            <label class="slds-form-element__label" for="textarea-input-01">
                            <abbr class="slds-required" style="color: red;" title="required">*</abbr> Solved By :</label>
                            <div class="slds-form-element__control">
                                <apex:inputField styleClass="slds-select" required="true" value="{!objCase.SolvedBy__c}" label="Solved By"/>
                            </div>
                            
                            

							<label class="slds-form-element__label" style="margin-top: 1%;" for="text-input-01">
                            <abbr class="slds-required" style="color: red;" title="required">*</abbr> Feature Function :</label>
 								<div class="slds-form-element slds-lookup" data-select="single">
                                <div class="slds-form-element__control" style="width: 94%;">
                                    <div class="slds-input-has-icon slds-input-has-icon--right">
                                        
                                        <apex:outputPanel id="FeatureFunction1">                             
                                            <apex:selectList label="FeatureFunctions" required="false" id="drpFeatureFunction" value="{!selFeatureFunctionId}" html-data-live-search="true" styleClass="selectpicker show-tick form-control" html-data-actions-box="true" html-data-done-button="true">
                                                <apex:selectOption html-data-hidden="true" itemValue="" itemLabel="Nothing Selected"/>
                                                <apex:selectOptions value="{!FeatureFunction}"/>
                                        
                                            </apex:selectList>
                                        </apex:outputPanel>
 									</div>
        						  </div>
                                </div>
                            
                            <label class="slds-form-element__label" for="textarea-input-01"  >
                                <abbr class="slds-required" style="color: red;" title="required" ></abbr> Other Reason </label>
                            <div class="slds-form-element__control">
                                <apex:inputField required="False" styleClass="slds-textarea slds-required" value="{!objCase.FF_Other__c}" label="Other Reason"/>
                             </div>