Skip to main content
edited tags
Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431
Rollback to Revision 2
Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

Below is my controller class code

public Account acctObj {
  public Account acctObjget;
 {get;set   set {
        new Account();
     } 
}
 public boolean checkMessageFlag {
    get;
    set {
        checkMessageFlag = true;
    } 
}
 public PageReference updateViewStateForCreditCheckMessage() {
    if(acctObj.Decline_Credit_Check__c == true) {
        checkMessageFlag = false;
    }
    return null;
 }

And below is the vf page codemarkup for my Visualforce Page

<apex:outputLabel id="creditCheckMessageId" value="*Credit Check has not been performed"
                            style="font-size: inherit;color:red;" rendered="{!checkMessageFlag}" ></apex:outputLabel>
                            <br></br>
                    &nbsp;&nbsp;
                    <apex:outputLabel ><apex:inputField value="{!acctObj.Decline_Credit_Check__c}">
                     <apex:actionSupport event="onchange"
                                                action="{!updateViewStateForCreditCheckMessage}"
                                                reRender="creditCheckMessageId"/>
                    </apex:inputField>&nbsp;&nbsp;Decline Credit Check </apex:outputLabel>

I am trying to remove the text when the check box is checked. but whenever I try to check the box i get an error saying "Attempt to dereference a null object". Any hep in this ?

Below is my controller class code

     public Account acctObj {get;set{
 new Account();
 }}
 public boolean checkMessageFlag {get; set{
 checkMessageFlag = true;
 }}
 public PageReference updateViewStateForCreditCheckMessage() {
    if(acctObj.Decline_Credit_Check__c == true){
        checkMessageFlag = false;
    }
    return null;
 }

And below is the vf page code

<apex:outputLabel id="creditCheckMessageId" value="*Credit Check has not been performed"
                            style="font-size: inherit;color:red;" rendered="{!checkMessageFlag}" ></apex:outputLabel>
                            <br></br>
                    &nbsp;&nbsp;
                    <apex:outputLabel ><apex:inputField value="{!acctObj.Decline_Credit_Check__c}">
                     <apex:actionSupport event="onchange"
                                                action="{!updateViewStateForCreditCheckMessage}"
                                                reRender="creditCheckMessageId"/>
                    </apex:inputField>&nbsp;&nbsp;Decline Credit Check </apex:outputLabel>

I am trying to remove the text when the check box is checked. but whenever I try to check the box i get an error saying "Attempt to dereference a null object". Any hep in this ?

Below is my controller class code

public Account acctObj {
    get;
    set {
        new Account();
     } 
}
public boolean checkMessageFlag {
    get;
    set {
        checkMessageFlag = true;
    } 
}
public PageReference updateViewStateForCreditCheckMessage() {
    if(acctObj.Decline_Credit_Check__c == true) {
        checkMessageFlag = false;
    }
    return null;
 }

And below is the markup for my Visualforce Page

<apex:outputLabel id="creditCheckMessageId" value="*Credit Check has not been performed"
                            style="font-size: inherit;color:red;" rendered="{!checkMessageFlag}" ></apex:outputLabel>
                            <br></br>
                    &nbsp;&nbsp;
                    <apex:outputLabel ><apex:inputField value="{!acctObj.Decline_Credit_Check__c}">
                     <apex:actionSupport event="onchange"
                                                action="{!updateViewStateForCreditCheckMessage}"
                                                reRender="creditCheckMessageId"/>
                    </apex:inputField>&nbsp;&nbsp;Decline Credit Check </apex:outputLabel>

I am trying to remove the text when the check box is checked. but whenever I try to check the box i get an error saying "Attempt to dereference a null object". Any hep in this ?

edited tags
Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431
Rollback to Revision 1
Source Link
user5129806
  • 169
  • 2
  • 5
  • 16
Loading
added 88 characters in body
Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431
Loading
Source Link
user5129806
  • 169
  • 2
  • 5
  • 16
Loading