You need to sign in to do that
Don't have an account?
Vishnu_SFDC
Error for save botton in visualforce page
ERROR: Attempt to de-reference a null object
Error is in expression '{!save}' in component <apex:commandButton> in page installer_view
My Visualforce page:
<apex:page standardController="Installers__c" showHeader="true" tabStyle="Installers__c" extensions="MultiAttachmentController">
<apex:sectionHeader subtitle="{!Installers__c.Name}" title="Installer"/>
<chatter:feedWithFollowers entityId="{!Installers__c.id}"/>
<br>
</br>
<apex:form >
<apex:actionRegion >
<apex:pageblock title="Installer Detail" mode="mainDetail">
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!Edit}" style="display: inline;" />
<apex:commandButton value="Delete" action="{!Delete}" />
<apex:commandButton action="{!URLFOR($Action.Installers__c.Upload_Documents,Installers__c.Id)}" value="Upload Documents"/>
<apex:commandButton Action="{!save}" id="saveButton" value="Save" />
<apex:commandButton Action="{!Cancel}" id="cancelButton" value="Cancel" style="display: None;" />
........
My Component
<apex:component controller="MultiAttachmentController" allowDML="true">
<apex:attribute name="objId" type="String" description="The id of the object to manage attachments for" required="true" assignTo="{!sobjId}"/>
<apex:form id="attForm">
<apex:pageBlock title="Upload Attachments">
<apex:repeat value="{!newAttachments}" var="newAtt">
<apex:pageBlockSection columns="3">
<apex:outputLabel value="Title">
<apex:selectList id="Title" value="{!Title}" size="1">
.......................
My Controller
public with sharing class MultiAttachmentController
{
public String delet { get; set; }
id token = ApexPages.currentPage().getParameters().get('_CONFIRMATIONTOKEN');
Id attId = System.currentPageReference().getParameters().get('id');
public MultiAttachmentController(ApexPages.StandardController stdcontroller2) {
}
// the parent object it
public Id sobjId {get; set;}
// list of existing attachments - populated on demand
public List<Attachment> attachments ;
public List<Note> Notes ;
//list of picklist values
public String Title {get; set;}
// list of new attachments to add
public List<Attachment> newAttachments {get; set;}
// the number of new attachments to add to the list when the user clicks 'Add More'
public static final Integer NUM_ATTACHMENTS_TO_ADD=5;
// constructor
public MultiAttachmentController()
{
// instantiate the list with a single attachment
newAttachments=new List<Attachment>{new Attachment()};
}
....................
I get this error in only View mode(Inline Editing). When i am in Edit mode i dont get this error.
Error is in expression '{!save}' in component <apex:commandButton> in page installer_view
My Visualforce page:
<apex:page standardController="Installers__c" showHeader="true" tabStyle="Installers__c" extensions="MultiAttachmentController">
<apex:sectionHeader subtitle="{!Installers__c.Name}" title="Installer"/>
<chatter:feedWithFollowers entityId="{!Installers__c.id}"/>
<br>
</br>
<apex:form >
<apex:actionRegion >
<apex:pageblock title="Installer Detail" mode="mainDetail">
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!Edit}" style="display: inline;" />
<apex:commandButton value="Delete" action="{!Delete}" />
<apex:commandButton action="{!URLFOR($Action.Installers__c.Upload_Documents,Installers__c.Id)}" value="Upload Documents"/>
<apex:commandButton Action="{!save}" id="saveButton" value="Save" />
<apex:commandButton Action="{!Cancel}" id="cancelButton" value="Cancel" style="display: None;" />
........
My Component
<apex:component controller="MultiAttachmentController" allowDML="true">
<apex:attribute name="objId" type="String" description="The id of the object to manage attachments for" required="true" assignTo="{!sobjId}"/>
<apex:form id="attForm">
<apex:pageBlock title="Upload Attachments">
<apex:repeat value="{!newAttachments}" var="newAtt">
<apex:pageBlockSection columns="3">
<apex:outputLabel value="Title">
<apex:selectList id="Title" value="{!Title}" size="1">
.......................
My Controller
public with sharing class MultiAttachmentController
{
public String delet { get; set; }
id token = ApexPages.currentPage().getParameters().get('_CONFIRMATIONTOKEN');
Id attId = System.currentPageReference().getParameters().get('id');
public MultiAttachmentController(ApexPages.StandardController stdcontroller2) {
}
// the parent object it
public Id sobjId {get; set;}
// list of existing attachments - populated on demand
public List<Attachment> attachments ;
public List<Note> Notes ;
//list of picklist values
public String Title {get; set;}
// list of new attachments to add
public List<Attachment> newAttachments {get; set;}
// the number of new attachments to add to the list when the user clicks 'Add More'
public static final Integer NUM_ATTACHMENTS_TO_ADD=5;
// constructor
public MultiAttachmentController()
{
// instantiate the list with a single attachment
newAttachments=new List<Attachment>{new Attachment()};
}
....................
I get this error in only View mode(Inline Editing). When i am in Edit mode i dont get this error.
Phillip Southern
If you capture a debug log for this (either in setup -> monitoring or developer console) what line it is tellingy you the de-reference is happening?