0

I have a VF page that uses Apex Classes to ReRender a PageBlock, based on what's chosen in a multi-pick list by a guest user.

Previously, the user would choose a concern, and receive a technology recommendation based on their choice. This has worked in the past, and I'm not sure what has changed.

Here is my VF page Code:

<apex:page docType="html-5.0" standardController="Opportunity" extensions="IntakeExtension,ShouldShowSHSection,ShouldShowSHwECSection,ShouldShowPERSSection,ShouldShowMedSection,ShouldShowRingSection" standardStyleSheets="false" showHeader="false" sidebar="false">
    
  <apex:stylesheet value="{!$Resource.styleForIntake}"/>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
   
  
  
<body>
<!-- multistep form -->
<apex:form Id="msform" styleClass="form">
  
    <p>  
        Personal Care Concerns:
     </p>
    <div class="selectiondiv">
        <apex:pageblock >
            <apex:pageblockSection >
                <apex:inputField styleClass="fieldset" value="{!Opportunity.Personal_Care_Concerns__c}">
                <apex:actionSupport event="onchange" reRender="technologyRecommendation"/>
                </apex:inputField>
            </apex:pageblockSection>
        </apex:pageblock>
    </div>
    <br></br> <br></br>
    <p>  
        Safety Concerns:
     </p>
    <div class="selectiondiv">
        <apex:pageblock >
            <apex:pageblockSection >
                <apex:inputField styleClass="fieldset" value="{!Opportunity.Safety_Concerns__c}">
                   <apex:actionSupport event="onchange" reRender="technologyRecommendation"/>
                </apex:inputField>
            </apex:pageblockSection>
        </apex:pageblock>
    </div>
    <br></br> <br></br>
    
      <p>  
        Physical Concerns:
     </p>
    <div class="selectiondiv">
        <apex:pageblock >
            <apex:pageblockSection >
                <apex:inputField styleClass="fieldset" value="{!Opportunity.Physical_Concerns__c}">
                   <apex:actionSupport event="onchange" reRender="technologyRecommendation"/>
                </apex:inputField>
            </apex:pageblockSection>
        </apex:pageblock>
    </div>
    
    <br> </br><br></br>
    
    
    <p>  
        Social Concerns:
     </p>
    <div class="selectiondiv">
        <apex:pageblock >
            <apex:pageblockSection >
                <apex:inputField styleClass="fieldset" value="{!Opportunity.Social_Concerns__c}">
                   <apex:actionSupport event="onchange" reRender="technologyRecommendation"/>
                </apex:inputField>
            </apex:pageblockSection>
        </apex:pageblock>
    </div>
  
      <fieldset>
    <h2 class="fs-title">Technology Recommendation</h2>
    <h3 class="fs-subtitle">Based on your selections for 'Concerns Addressed', we recommend the following technology:</h3>
           
           <apex:pageblock id="seizures">
               <apex:outputText rendered="{!IF(CONTAINS(Opportunity.Population__c, 'Epilepsy/Seizures'), 'true', 'false')}" value="We do not currently support Epilepsy/Seizure-detecting technology."/> <br/>
               <apex:outputText rendered="{!IF(CONTAINS(Opportunity.Population__c, 'Epilepsy/Seizures'), 'true', 'false')}" value="However, we may be able to assist with additionally noted concerns."/>
           </apex:pageblock>
           
           <apex:pageblock id="technologyRecommendation" mode="maindetail">
           
           
           <apex:pageblockSection rendered="{!shouldShowSHwECSection}" columns="1">
               
                    <h3 class="fs-subtitle">Environmental Control System Recommendation</h3>  
                    <br></br><br></br><apex:outputText value="Who will be overseeing the technology in the residence and/or teaching the individual how to use the technology? "/> <br></br>
               </apex:pageblockSection>
               
               <apex:pageblockSection rendered="{!shouldShowSHSection}" columns="1">
                    <h3 class="fs-subtitle">SH System Recommendation</h3> 
                    <br></br><br></br><apex:outputText value="Who will be overseeing the technology in the residence and/or teaching the individual how to use the technology? "/> <br></br>
               </apex:pageblockSection>
               
               <apex:pageblockSection rendered="{!shouldShowMedSection}" columns="1">
                    <h3 class="fs-subtitle">Medication Dispenser Recommendation</h3> 
                    <br></br><br></br><apex:outputText value="Who will be overseeing the technology in the residence and/or teaching the individual how to use the technology? "/> <br></br>
               </apex:pageblockSection>
               
               <apex:pageblockSection rendered="{!shouldShowPERSSection}" columns="1">
                    <h3 class="fs-subtitle">Personal Emergency Response System (PERS) Recommendation</h3> 
<apex:outputText value="Who will be overseeing the technology in the residence and/or teaching the individual how to use the technology? "/> <br>
               </apex:pageblockSection>
               
               <apex:pageblockSection rendered="{!shouldShowRingSection}">
                    <h3 class="fs-subtitle">Ring Device(s) Recommendation</h3> 
                    <br/> <apex:outputText value="The possibility of Ring devices will be discussed during your assessment call."/>
               </apex:pageblockSection>
   
               
               
        </apex:pageblock>
        

 <apex:commandButton action="{!save}" rerender="msgs" styleClass="submit action-button" style="width=100px" value="Submit" id="saveButton" />
    
    <div class="msgsdiv">
       <apex:pageMessages id="msgs"/>
     </div>     
     </fieldset> 
 
</apex:form>

<script>
//jQuery time

</script>



</body>
</apex:page>

Here is an example of one of my Apex classes that has previoulsy worked - I have not made changes to this since the last time it was working:

public with sharing class ShouldShowMedSection{
    public ShouldShowMedSection(ApexPages.StandardController paramController) {
       standardController = paramController;}
    public ApexPages.StandardController standardController {get; set;}
    public Boolean getShouldShowMedSection() {
   Opportunity record = (Opportunity)standardController.getRecord(); 
      return record.Personal_Care_Concerns__c != null && record.Personal_Care_Concerns__c.contains('Medication');
        }
        }

1 Answer 1

0

The issue was resolved the I removed all instances of required="true" from other fields within my VF page - I'm not sure why that caused an error with rendering, but it did!

2
  • Congrats! You might get around this problem by putting your picklists into ActionRegion tags. That will let you make changes to them without the required fields firing the page validation errors. Apr 20, 2021 at 3:17
  • 1
    Perfect! This is exactly how I was able to solve it - Thank you! Apr 20, 2021 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.