function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Error on save button in Visulforce 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="{!}"/>
<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.

Why do you need Save on View mode? We provide save button on Edit mode.
Hi Vinita,

Thanks for the reply.
i  use save button in view mode as i am providing inline edit support for my users.