0

I must be doing something silly with my code, but cannot for the life of me figure out why neither the Boolean userNeedsVerify nor the method checkForVerify() are rendering when they should be. I've done this in the past and not had any issues.

The criteria definitely matches correctly since my debug statement returns true at line 15:

11:16:43:046 USER_DEBUG [15]|DEBUG|hit me test=true

Is there something wrong with the way I have my getter/setter

Relevant Visualforce:

<apex:page controller="UpdateUserInfoController">
    <apex:form >
        <apex:outputText rendered="userNeedsVerify" value="firstRender"/>
        <apex:outputText rendered="checkForVerify()" value="SecondRender"/>
    </apex:form>
</apex:page>

Entire Controller:

public class UpdateUserInfoController {

    public User userRecord {get;set;}
    public Boolean userNeedsVerify {get;set;}

    public UpdateUserInfoController () {
        userRecord= [SELECT Id,Name, Title, Street, City, State, PostalCode, Country, Phone, MobilePhone, Email, Date_Last_Verified__c  FROM User
                   WHERE id=:userinfo.getuserid()];

        //if user was not modified in the 3 months
        Date threeMonthsAgo = Date.ValueOf(System.Now().addDays(-91));
        if(userRecord.Date_Last_Verified__c < threeMonthsAgo || userRecord.Date_Last_Verified__c == null){
            System.Debug('b4='+userNeedsVerify);
            userNeedsVerify = true;
            System.Debug('hit me test='+userNeedsVerify);
        }

    }

    public Boolean checkForVerify(){
        Date threeMonthsAgo = Date.ValueOf(System.Now().addDays(-91));
        if(userRecord.Date_Last_Verified__c < threeMonthsAgo || userRecord.Date_Last_Verified__c == null){
        system.debug('yes');
            return true;
        }
        else{
        system.debug('no');
            return false;
        }
    }

    public User getUser() {
        return userRecord;
    }

    public PageReference save() {
        userRecord.Date_Last_Verified__c = Date.ValueOf(System.Now());
        update userRecord;
        return null;
    }
}
3

You should write:

<apex:outputText rendered="{!userNeedsVerify}" value="firstRender"/>

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.