You need to sign in to do that
Don't have an account?
Sree Salesforce
I got a small error like System.NullPointerException: Attempt to de-reference a null object Error is in expression '{!save}' in component <apex:commandButton> in page actionstatus: Class.storedata.save: line 17, column 1
<apex:page controller="storedata" showHeader="false">
<apex:form >
<apex:pageBlock title="account details">
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}" status="acctid"/>
</apex:pageBlockButtons>
<apex:pageblockSection >
<apex:inputField value="{!acc.name}"/>
<apex:inputField value="{!acc.type}"/>
<apex:inputField value="{!acc.phone}"/>
</apex:pageblockSection>
<apex:pageBlockSection >
<apex:inputField value="{!acc.rating}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class storedata {
public account getAccount() {
return acc;
}
public account acc { get; set; }
public storedata()
{
list<account> acc=[select id,name,type,phone,rating from account where id=:apexpages.currentpage().getparameters().get('id')];
}
public PageReference save() {
update acc;
return null;
}
}
<apex:form >
<apex:pageBlock title="account details">
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}" status="acctid"/>
</apex:pageBlockButtons>
<apex:pageblockSection >
<apex:inputField value="{!acc.name}"/>
<apex:inputField value="{!acc.type}"/>
<apex:inputField value="{!acc.phone}"/>
</apex:pageblockSection>
<apex:pageBlockSection >
<apex:inputField value="{!acc.rating}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class storedata {
public account getAccount() {
return acc;
}
public account acc { get; set; }
public storedata()
{
list<account> acc=[select id,name,type,phone,rating from account where id=:apexpages.currentpage().getparameters().get('id')];
}
public PageReference save() {
update acc;
return null;
}
}
Best Answer chosen by Sree Salesforce
Ashwani
Try it: