• TanD
  • NEWBIE
  • 35 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 12
    Replies
I am trying to display an output field value in VF page before saving the record. If user select checkIn & checkOut date  (both are date field), display the "Length of stay". Length of Stay is a formula field which is equal to (Check out date - check in date)
User-added image

Below is whatever I have tried so far (no error in any code): 
Method 1:
VF
<table id="check-table">
    <thead> <td style="font-weight:bold"> Check In </td>       <td style="font-weight:bold"> Check Out </td> <td> </td> <td></td> </thead>                       
    <tr>
        <td> <c:NoDateLink > <apex:inputField value="{!objectReservation.Check_In__c }" id="startdate" style="width:10rem; margin-right:1rem;"  /> </c:NoDateLink> </td> <!--  rerender="lengthOfStay" background:url('DateIcon.png'); background-size: 1px 2px; background-repeat: no-repeat; -->
        <apex:actionRegion >
            <apex:outputPanel >
                <td><c:NoDateLink > <apex:inputField value="{!objectReservation.Check_Out__c }"   id="enddate" style="width:10rem;"  > 
                    <apex:actionSupport event="onchange" rerender="lengthOfStay"   />                                  
                    </apex:inputField> </c:NoDateLink> </td>   
            </apex:outputPanel>
        </apex:actionRegion>
        <td style="padding:0 2rem 0 2rem;" >  Length of Stay </td>
        <td >  <apex:outputField value="{!objectReservation.Length_of_Stay__c}" id="lengthOfStay"/> </td>
    </tr>
</table> <!-- End of Check-table -->

No error in VF page, but, onchange in CheckOut field, nothing changes. 

Method 2:
I also tried to put value from Apex class, but not sure about the syntax as follow: 
public void onChangeFnCall(){
        if(objectReservation.Check_Out__c  != null){
  
            Integer numberOfStay = (objectReservation.Check_In__c).daysBetween(objectReservation.Check_Out__c);
    //      objectReservation.Length_of_Stay__c = numberOfStay;
        }

VF
<table id="check-table">
    <thead> <td style="font-weight:bold"> Check In </td>       <td style="font-weight:bold"> Check Out </td> <td> </td> <td></td> </thead>                       
    <tr>
        <td> <c:NoDateLink > <apex:inputField value="{!objectReservation.Check_In__c }" id="startdate" style="width:10rem; margin-right:1rem;"  /> </c:NoDateLink> </td> <!--  rerender="lengthOfStay" background:url('DateIcon.png'); background-size: 1px 2px; background-repeat: no-repeat; -->
        <apex:actionRegion >
            <apex:outputPanel >
                <td><c:NoDateLink > <apex:inputField value="{!objectReservation.Check_Out__c }"   id="enddate" style="width:10rem;"  > 
                    <apex:actionSupport event="onchange" action="{!onchangefncall}" rerender="lengthOfStay"   />                                  
                    </apex:inputField> </c:NoDateLink> </td>   
            </apex:outputPanel>
        </apex:actionRegion>
        <td style="padding:0 2rem 0 2rem;" >  Length of Stay </td>
        <td >  <apex:outputField value="{!objectReservation.Length_of_Stay__c}" id="lengthOfStay"/> </td>
    </tr>
</table> <!-- End of Check-table -->


 
I am trying to import a custom object which has 18 digit id, even though it is 18 digit id, the import fails, & Error log say 15 digit id (seems like SF convert my 18 digit id into 15 digit which is highly unlike).
User-added image
As my column is already 18 digit, converting into standard 18 digit is not a solution. Please help how to import successfully. 
Is there any implication of Match By filter during the mapping (if all related fields exist in next step) that might throw the error?
User-added image 
I have exported all data from previous SF org by Data Export wizard, & all app & custom objects from previous org are moved to new org by unmanged packaging. 
I need 1 GB storage for records, 5 GB storage for file (Data Storage = 1 GB, File Storage = 5 GB). I am using Developer edition. Can you please suggest me a great app which can provide me 1 Gb DataStorage & 5Gb FileStorage?  
How to buy additional storage from Salesforce? I am trying to contact Accounting rep, but failed to login to Power of US hub as it says my Salesforce Developer edition is not registered, & there is no signup button. I can’t free up spaces by deleting any object or anything from my SF org.
These apps seems good, but only for FILE STORAGE.
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003IzEDEA0
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000008amNrEAI (review is not good)
My apex class is working as desired, but when I convert it to an extension (as my visualforce page has already a custom controller), it is not working.
I have a RemoteAction written in a Apex class which performs auto complete lookup fields. DId I miss anything in save_custom button of custom controller, or the syntax of Controller Extension for custom controller? Why the same code working good as controller, but not as extension? 
public class ExtensionAutocomplete {
    public General_Ledge_Account__c wildCardForGeneralLedgerAccount {get; set;}
    public General_Ledge_Account__c selected {get; set;}
    public Tax_Code__c wildCardForTaxCode {get; set;}
    public Tax_Code__c selectedTC {get; set;}
    public Journal__c wildCardForJournal {get; set;}
    public Journal__c selectedJ {get; set;}    
    public Dimension__c wildCardForDimension {get; set;}
    public Dimension__c selectedD {get; set;}  
    
	// Constructor for extension of custom controller 
	// 
    public ExtensionAutocomplete(JournalDetail_Controller_2T ctrlParam) {    // JournalDetail_Controller_2T is the controller for the VF page 
    }
    // JavaScript Remoting Action call 
    @RemoteAction
    public static List<General_Ledge_Account__c> lookupSearch(String wildCardForGeneralLedgerAccount) {
        System.debug('lookup: '+wildCardForGeneralLedgerAccount );
        List<General_Ledge_Account__c> master = Database.query('Select Id, Name from General_Ledge_Account__c where Name like \'%' + String.escapeSingleQuotes(wildCardForGeneralLedgerAccount) + '%\'');
        return master;
    }

Custom Controller: 
public with sharing class JournalDetail_Controller_2T  {
    // MVC concept to data binding in VF page & controller
    public Journal__c objectJournal{get; set;}
    public Line_Item__c objectLineItem{get; set;}
        
    //define the constructor 
      public JournalDetail_Controller_2T(ApexPages.StandardController stdController) {}

    public JournalDetail_Controller_2T(){
        // Initiate objects 
        objectJournal = new Journal__c();
        objectLineItem = new Line_Item__c();
    }
    public void save_custom()
    {
        try
        {
            insert objectJournal;
            insert objectLineItem;
        }   
        catch(Exception ex)
        {
            System.debug('\n\nException ='+ex.getMessage()+'\n\n');
        }    
    }
    public void cancel(){}  
    
       }

VF
 
<apex:page id="page" Controller="JournalDetailController_T"  sidebar="false" showHeader="false" standardStylesheets="false" >
    <apex:form id="form" >
        <html id="html">
            <head id="head">
                
                <style>
                    *{
                    <!-- font-size: 1.2vw;           viewport sized typography -->
                    }
                    html{
                    background-color: #E7EDF3;
                    }
                    body{ 
                    margin: 1rem; background-color: white;
                    }    
                    h3{
                    clear:both; background-color: #5B5DFE; width: 95%; padding-left: 1rem; color: white; margin: 2% 2.5% 1% 2.5%;
                    }
                    #div-table-1, #journal-status-left{
                    float: left; width: 45%; margin-left: 5%;
                    }
                    #div-table-2{
                    
                    }
                    #journal-detail-table-1{
                    
                    }
                    #journal-detail-table-2{
                    
                    }
                    #line-item-table{
                    margin-left: 5%;
                    }
                    #accordion3{
                    padding-bottom: 3%;
                    }
                    .lookupInput
                    {
                    display: inline;
                    vertical-align: middle;
                    white-space: nowrap;
                    }
                    .lookupInput img
                    {
                    background-repeat: no-repeat;
                    margin-right: .25em;
                    vertical-align: middle;
                    }
                    .lookupInput .disabled
                    {
                    background-color: #ccc;
                    }
                    .lookupInput .emptyDependentLookup
                    {
                    font-style: italic;
                    }
                    .lookupInput input[readonly]
                    {
                    background-color: #e6e6e6;
                    border: 2px solid #e6e6e6;
                    color: #333;
                    cursor: default;
                    }
                    .lookupInput a.readOnly
                    {
                    float: right;
                    }
                    .lookupInput span.readOnly
                    {
                    display: block;
                    white-space: normal;
                    }
                    .lookupInput span.totalSummary
                    {
                    font-weight: bold;
                    }
                    .inlineEditRequiredDiv .lookupInput img,.inlineEditDiv .lookupInput img
                    {
                    vertical-align: middle;
                    }
                    .quickCreateModule .lookupInput input {
                    max-width: 155px
                    }
                    .lookupIcon {
                    background-image: url(/img/func_icons/util/lookup20.gif);
                    background-position: 0 0;
                    width: 20px;
                    height: 20px;
                    background-position: top left
                    }
                    .lookupIconOn {
                    background-image: url(/img/func_icons/util/lookup20.gif);
                    background-position: 0 0;
                    width: 20px;
                    height: 20px;
                    background-position: top right
                    }
                </style>    
                <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
                <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
                <apex:includeScript value="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.10/angular.min.js"/>
                <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
                <script>
                $(function() { $("#accordion1").accordion({ header: "h3", collapsible: true }); });
                $(function() { $("#accordion2").accordion({ header: "h3", collapsible: true }); });
                $(function() { $("#accordion3").accordion({ header: "h3", collapsible: true }); });
                </script>
            </head>
            
            
            <body id="body" >
                <div>
                    <b> <span style="margin: 0 5% 0 5%; font-size:1.5rem">Journal Detail </span> </b>
                    
                    <apex:commandButton action="{!save_custom}" value="Post" style="background-color:#5B5DFE; color:white;font-weight: bold;  padding: .5rem 2rem .5rem 2rem; margin: 3rem 1rem 1rem 0; " />
                    <apex:commandButton action="{!cancel}" value="Cancel" style="background-color:#5B5DFE; color:white;font-weight: bold;  padding: .5rem 2rem .5rem 2rem; margin: 3rem 1rem 1rem 0; " />
                </div>
                <div class="journal-detail" id="accordion1" >
                    <h3>
                        Journal Detail
                    </h3>
                    <div>
                        <div id="div-table-1">
                            <table id="journal-detail-table-1" border="1" >
                                <apex:pageBlock >
                                    <apex:pageBlockSection >
                                        <tr>  
                                            <apex:inputField value="{!objectJournal.Type__c}"  /> </tr> <tr>
                                        <apex:inputField value="{!objectJournal.Journal_Date__c}" /> </tr><tr>
                                        <apex:inputField value="{!objectJournal.Journal_Currency__c}" /> </tr> <tr>
                                        <apex:inputField value="{!objectJournal.Reference__c}" /> </tr> <tr>
                                        <apex:inputField value="{!objectJournal.Journal_Description__c}"  /> </tr><tr>
                                        <apex:inputField value="{!objectJournal.Transaction__c}"  /> </tr> <tr>
                                        </tr>
                                    </apex:pageBlockSection>
                                </apex:pageBlock>
                            </table>
                        </div>
                        <div id="div-table-2">
                            <table  id="journal-detail-table-2" >
                                <apex:pageBlock >
                                    <apex:pageBlockSection >
                                        <tr><apex:outputField value="{!objectJournal.Name}" /> </tr> <tr> 
                                        <apex:inputField value="{!objectJournal.Period__c}"  /> </tr> <tr>
                                        <apex:inputField value="{!objectJournal.Debits__c}" /> </tr><tr>
                                        <apex:inputField value="{!objectJournal.Credits__c}"  />  </tr> <tr>
                                        <apex:inputField value="{!objectJournal.Invoice_Number__c}" /></tr><tr>
                                        <apex:inputField value="{!objectJournal.Total__c}" /> </tr>
                                    </apex:pageBlockSection>
                                </apex:pageBlock>
                            </table>
                        </div>
                    </div>
                </div>
                
                <div id="accordion2">
                    <h3 >
                        Journal Line Item
                    </h3>    
                   
				<div id="room-and-adding-room">
                	    <div id="field_wrapper_header_id" class="field_wrapper_header">
                                Line Type   	Line Description 		Journal			General Ledger Account	 	Amount 
                                Tax Code		Tax Amount 				Total Amount 	Dimension 

                    </div>
                    <div class="field_wrapper" style="border: dotted;" >
                        <div>      <apex:inputField value="{!objectLineItem.Line_Type__c}" style="width:3rem; float:left;"/> </div><div>
                        <apex:inputField value="{!objectLineItem.Line_Description__c}" style="width:5rem; float:left;"/> </div><div>
                        <apex:inputField value="{!objectLineItem.Journal__c}" style="width:3rem; float:left;"/> </div><div>
                        <apex:inputField value="{!objectLineItem.General_Ledge_Account__c}" style="width:4rem; float:left;"/> </div><div>
                        <apex:inputField value="{!objectLineItem.Amount__c}" style="width:5rem;  float:left;"/> </div><div>
                        <apex:inputField value="{!objectLineItem.Tax_Code__c}" style="width:5rem; float:left;"/> </div><div>
                        <apex:outputText value="{!objectLineItem.Tax_Amount__c}" style="width:3rem; float:left;"/> </div><div>
                        <apex:outputText value="{!objectLineItem.Total_Amount__c}" style="width:3rem; float:left;"/> </div><div>
                        <apex:inputField value="{!objectLineItem.Dimension_1__c}" style="width:6rem; float:left;"/> </div> <br/>
                </div> 
                    
                </div> <!-- End of room-and-adding-room div -->
                    <a href="javascript:void(0);" class="add_button"  title="Add field" style="background-color: red; display:inline-block;" > Add Room </a>
                    
                <div id="accordion3">
                    <h3 >
                        Journal Status
                    </h3>    
                    <div>
                    <div id="journal-status-left">
                        Journal Status <apex:inputField value="{!objectJournal.Journal_Status__c}" />
                    </div>
                    <div>
                        Discard Reason <apex:inputField value="{!objectJournal.Discard_Reason__c}" />
                    </div>
                    </div>
                </div>
                <!-- Script to enable autocomplete functionality -->

                    <apex:pageBlock id="searchBlock" >
                 <apex:outputLabel value="Search General Ledger Account" for="Box" />
                 <apex:outputPanel >
                     <apex:inputText id="TextBox" value="{!wildCardForGeneralLedgerAccount}" styleClass="General Ledger Account"/>
                     <apex:inputHidden id="searchId" value="{!selected}" /> <br/>
                 </apex:outputPanel>
                    
            <apex:outputLabel value="Search Tax Code" for="BoxTC" />
            <apex:outputPanel >
                     <apex:inputText id="TextBoxTC" value="{!wildCardForTaxCode}" styleClass="Tax code"/>
                <apex:inputHidden id="searchIdTC" value="{!selectedTC}" /> <br/>
            </apex:outputPanel>
           <apex:outputLabel value="Search Journal" for="BoxJ" />
            <apex:outputPanel >
                     <apex:inputText id="TextBoxJ" value="{!wildCardForJournal}" styleClass="wild card for Journal"/>
                <apex:inputHidden id="searchIdJ" value="{!selectedJ}" />  <br/>
                </apex:outputPanel>                                       
              <apex:outputLabel value="Search Dimension" for="BoxD" />
            <apex:outputPanel >
                     <apex:inputText id="TextBoxD" value="{!wildCardForDimension}" styleClass="wild card for Dimension"/>
                     <apex:inputHidden id="searchIdD" value="{!selectedD}" />    
                    </apex:outputPanel>
        </apex:pageBlock>
                </div>

    
                   	<!-- Script to add room -->
           <script type="text/javascript">
$(document).ready(function(){
    var maxField = 10; //Input fields increment limitation
    var addButton = $('.add_button'); //Add button selector
    var wrapper = $('.field_wrapper'); //Input field wrapper
    var fieldHTML = '<div><apex:inputField value="{!objectLineItem.Line_Type__c}" style="width:3rem; float:left;"/><apex:inputField value="{!objectLineItem.Line_Description__c}" style="width:5rem; float:left;"/><apex:inputField value="{!objectLineItem.Journal__c}" style="width:3rem; float:left;"/><apex:inputField value="{!objectLineItem.General_Ledge_Account__c}" style="width:4rem; float:left;"/><apex:inputField value="{!objectLineItem.Amount__c}" style="width:5rem;  float:left;"/><apex:inputField value="{!objectLineItem.Tax_Code__c}" style="width:5rem; float:left;"/><apex:outputText value="{!objectLineItem.Tax_Amount__c}" style="width:3rem; float:left;"/><apex:outputText value="{!objectLineItem.Total_Amount__c}" style="width:3rem; float:left;"/><apex:inputField value="{!objectLineItem.Dimension_1__c}" style="width:6rem; float:left;"/><a href="javascript:void(0);" class="remove_button" title="Remove field">Remove</a></div>';
    var x = 1; //Initial field counter is 1
    $(addButton).click(function(){ //Once add button is clicked
        if(x < maxField){ //Check maximum number of input fields
            x++; //Increment field counter
            $(wrapper).append(fieldHTML); // Add field html
        }
    });
    $(wrapper).on('click', '.remove_button', function(e){ //Once remove button is clicked
        e.preventDefault();
        $(this).parent('div').remove(); //Remove field html
        x--; //Decrement field counter
    });
});
</script>
    
    <script type="text/javascript">
    // A FOR LOOP will be added soon to optimize the length of the code
    // for id = [TextBox, TextBoxTC, TextBoxJ, TextBoxD]   searchID  $('[id$=id]')
    //------------------------------------GLA--------------------------
        var PLACEHOLDER = ''; 
        var masterObjects;
        var queryTerm;
        
        $('[id$=TextBox]').autocomplete({
            minLength: 0,
            source: function(request, response) {
                        queryTerm = request.term;
                        AutoCompleteLookupField.lookupSearch(request.term, function(result, event)  {
                            if(event.type == 'exception') {
                                  alert(event.message);
                            } else {
                                 masterObjects = result;
                                 response(masterObjects);
                            }
                        });
                   },
            focus: function( event, ui ) {
                    $('[id$=TextBox]').val( ui.item.Name );
                    return false;
                    },
            select: function( event, ui ) {
                        $('[id$=TextBox]').val( ui.item.Name );
                        $('[id$=searchId]').val( ui.item.Id );
                        return false;
                    },
         })
         .data( "autocomplete" )._renderItem = function( ul, item ) {
            var entry = "<a>" + item.Name;
           
            entry = entry + "</a>";
            entry = entry.replace(queryTerm, "<b>" + queryTerm + "</b>");
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( entry )
                .appendTo( ul );
        };
            
        // Add or remove placeholder values
        $('[id$=TextBox]').val(PLACEHOLDER);
        $('[id$=TextBox]').on("focus",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === PLACEHOLDER ){
                $tgt.val('');
                $tgt.removeClass('placeHolder');
            }
        });
        $('[id$=TextBox]').on( "blur",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === '' ){
                $tgt.val(PLACEHOLDER);
                $tgt.addClass('placeHolder');
            }
        });

    // ----------------------------------TC-----------------------
            var PLACEHOLDER = ''; 
        var masterObjectsTC;
        var queryTerm;
        $('[id$=TextBoxTC]').autocomplete({
            minLength: 0,
            source: function(request, response) {
                        queryTerm = request.term;
                        AutoCompleteLookupField.lookupSearchTC(request.term, function(result, event)  {
                            if(event.type == 'exception') {
                                  alert(event.message);
                            } else {
                                 masterObjectsTC = result;
                                 response(masterObjectsTC);
                            }
                        });
                   },
            focus: function( event, ui ) {
                    $('[id$=TextBoxTC]').val( ui.item.Name );
                    return false;
                    },
            select: function( event, ui ) {
                        $('[id$=TextBoxTC]').val( ui.item.Name );
                        $('[id$=searchIdTC]').val( ui.item.Id );
                        return false;
                    },
         })
         .data( "autocomplete" )._renderItem = function( ul, item ) {
            var entry = "<a>" + item.Name;
           
            entry = entry + "</a>";
            entry = entry.replace(queryTerm, "<b>" + queryTerm + "</b>");
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( entry )
                .appendTo( ul );
        };
            
        // Add or remove placeholder values
        $('[id$=TextBoxTC]').val(PLACEHOLDER);
        $('[id$=TextBoxTC]').on("focus",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === PLACEHOLDER ){
                $tgt.val('');
                $tgt.removeClass('placeHolder');
            }
        });
        $('[id$=TextBoxTC]').on( "blur",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === '' ){
                $tgt.val(PLACEHOLDER);
                $tgt.addClass('placeHolder');
            }
        });

    // -----------------------------------------------------====================Journal
       var PLACEHOLDER = ''; 
        var masterObjectsJ;
        var queryTerm;
        $('[id$=TextBoxJ]').autocomplete({
            minLength: 0,
            source: function(request, response) {
                        queryTerm = request.term;
                        AutoCompleteLookupField.lookupSearchJ(request.term, function(result, event)  {
                            if(event.type == 'exception') {
                                  alert(event.message);
                            } else {
                                 masterObjectsJ = result;
                                 response(masterObjectsJ);
                            }
                        });
                   },
            focus: function( event, ui ) {
                    $('[id$=TextBoxJ]').val( ui.item.Name );
                    return false;
                    },
            select: function( event, ui ) {
                        $('[id$=TextBoxJ]').val( ui.item.Name );
                        $('[id$=searchIdJ]').val( ui.item.Id );
                        return false;
                    },
         })
         .data( "autocomplete" )._renderItem = function( ul, item ) {
            var entry = "<a>" + item.Name;
           
            entry = entry + "</a>";
            entry = entry.replace(queryTerm, "<b>" + queryTerm + "</b>");
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( entry )
                .appendTo( ul );
        };
            
        // Add or remove placeholder values
        $('[id$=TextBoxJ]').val(PLACEHOLDER);
        $('[id$=TextBoxJ]').on("focus",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === PLACEHOLDER ){
                $tgt.val('');
                $tgt.removeClass('placeHolder');
            }
        });
        $('[id$=TextBoxJ]').on( "blur",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === '' ){
                $tgt.val(PLACEHOLDER);
                $tgt.addClass('placeHolder');
            }
        });

    // -----------------=============================---------------________________ Dimension
       var PLACEHOLDER = ''; 
        var masterObjectsD;
        var queryTerm;
        $('[id$=TextBoxD]').autocomplete({
            minLength: 0,
            source: function(request, response) {
                        queryTerm = request.term;
                        AutoCompleteLookupField.lookupSearchD(request.term, function(result, event)  {
                            if(event.type == 'exception') {
                                  alert(event.message);
                            } else {
                                 masterObjectsD = result;
                                 response(masterObjectsD);
                            }
                        });
                   },
            focus: function( event, ui ) {
                    $('[id$=TextBoxD]').val( ui.item.Name );
                    return false;
                    },
            select: function( event, ui ) {
                        $('[id$=TextBoxD]').val( ui.item.Name );
                        $('[id$=searchIdD]').val( ui.item.Id );
                        return false;
                    },
         })
         .data( "autocomplete" )._renderItem = function( ul, item ) {
            var entry = "<a>" + item.Name;
           
            entry = entry + "</a>";
            entry = entry.replace(queryTerm, "<b>" + queryTerm + "</b>");
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( entry )
                .appendTo( ul );
        };
            
        // Add or remove placeholder values
        $('[id$=TextBoxD]').val(PLACEHOLDER);
        $('[id$=TextBoxD]').on("focus",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === PLACEHOLDER ){
                $tgt.val('');
                $tgt.removeClass('placeHolder');
            }
        });
        $('[id$=TextBoxD]').on( "blur",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === '' ){
                $tgt.val(PLACEHOLDER);
                $tgt.addClass('placeHolder');
            }
        });

    </script>
                            </body>
        </html>
    </apex:form>
</apex:page>

 
Overriding NEW button of record detail page of custom OBJECT, no VF page found
I am trying to override standard SF page with a VF page for a custom object. For NEW button of the record detail page of a custom object, I want to replace that. But, no visualforce page is there to select from (image shown). The VF is associated with an apex class of custom controller. 
I have two objects Speaker__c, Session__c. I want to create a single VF page which will includes fields from both objects. VF page will have inputField / inputText type of field. The class through error: Initial terms of field expression must be a concrete sObject: List
VF code through the error: Unknown property 'VFpageName.Session__c'
If I dont initiate objects with List<>, apex class will be fine, but VF page shows same error. How to fix this?
My code: 
Class 
public class SingleVFPagePullDataFromMultipleObjects {
    // MVC concept to data binding in VF page & controller
    public List<Speaker__c> objectSpeaker {get; set;}
    public List<Session__c> objectSession {get; set;}
    
    //define the function
    public SingleVFPagePullDataFromMultipleObjects(){
    // Initiate objects 
        List<Speaker__c> objectSpeaker = new List<Speaker__c>();
        List<Session__c> objectSession = new List<Session__c>();
    }
    // Save button
    public void save()
    {
    	try
        {
            insert objectSpeaker;
            objectSession.Speaker_Name__c = objectSpeaker.id;
            insert objectSession;
        }   
        catch(Exception ex)
        {
            System.debug('\n\nException ='+ex.getMessage()+'\n\n');
        }    
    }
    public void cancel(){}    
}

VF
<apex:page controller="SingleVFPagePullDataFromMultipleObjects" >
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection>

                <apex:inputText value="{!Session__c.Session_Date__c }" />
                <apex:inputText value="{!Session__c.Description__c }" />
                <apex:inputText value="{!Session__c.Level__c }" />
                <apex:inputText value="{!Speaker__c.Last_Name__c }" />
                <apex:inputText value="{!Speaker__c.Bio__c }" />                
            </apex:pageBlockSection>
            
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
In "Getting Started with Accounts and Contacts", entered required data for Smith Enterprises account and Amanda Smith contact with CEO title, can see both records via SOSL in Workbench, but getting error message.

What am I missing?
Hi Friends Thanks in advance,
Agenda: insted of "Account" object I need Organization__C
I want this feature for My custom Object (i.e., Organization__C) where can i have place my custom object insted of 'Account' Object.

When i replace Account with my custom object I am facing Below error
"Visualforce Error  System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Organization__C.Name"

Working Code
Apex Class
public class AutoCompleteDemoController{
    public list<account> getAccountList(){
        return [select id,name from account limit 25];
    }
}
VF Page
<apex:page controller="AutoCompleteDemoController">
    <!--Make sure you have the Javascript in the same order that I have listed below.-->
    <script src="https://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="/soap/ajax/26.0/connection.js" type="text/javascript"></script>
    <script src="https://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css"/>
    <script type="text/javascript">
        var j$ = jQuery.noConflict();
        var apexAccountList =[];
         
        //use the <!-- <apex:repeat> -->tag to iterate through the list returned from the class and store only the names in the javascript variable.
        <apex:repeat value="{!accountList}" var="accList">
            //Store the name of the account in the array variable.
            apexAccountList.push('{!accList.name}');
        </apex:repeat>
         
        //We will establish a connection salesforce database using the sforce.connection.init(sessionID, ServerURL) function.
        var sid = '{!$Api.Session_ID}';
        var server = "https://" + window.location.host + "/services/Soap/u/26.0";
        sforce.connection.init(sid, server);
         
        //We will query the contact object using the sforce.connection.query function. This will return 200 results.
        var result = sforce.connection.query("select Name from Contact");
        var records = result.getArray("records");
        var javascriptContactList =[];
         
        //Iterate thru the list of contact and store them in a javascript simple array variable which will then assign it to the source of the autocomplete.
        for(i=0;i<records.length;i++){
            javascriptContactList[i]=records[i].Name;
        }
        //on Document ready
        j$(document).ready(function(){
             
            j$("#apexaccountautocomplete").autocomplete({
                source : apexAccountList
            });
            j$("#sfjscontactautocomplete").autocomplete({
                source : javascriptContactList
            });
        });
    </script>
     
    <apex:form>
        <b>Account(This uses the Apex class to display the list)</b><input type="text" id="apexaccountautocomplete"/><br/><br/>
        <b>Contact(This uses the salesforce's ajax toolkit to display the list)</b><input type="text" id="sfjscontactautocomplete"/>
    </apex:form>
     
</apex:page>

Thanks
Swetha

 
Hi All,

I have a custom object called Leap_Weekly_Curriculum__c and I need a VF page that will help me input values into it and also upload a file which should get added to the attachments related list of the same record. Please help.
Hi,
I would like to know how we can create a controller extension for a custom controller.

My custom controller:

public class account_details{

public list<Account> accnt_list{get;set;}

public account_details(){
accnt_list= new list<Account>();
accnt_list=[select id,Name,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry FROM Account order by Name];
}
public pagereference edit_row(){
string str=apexpages.currentpage().getparameters().get('edit_id');
system.debug('------->'+str);
pagereference pg=new pagereference('/'+str+'/e');
return pg;
}
MY PAGE:

<apex:page controller="account_details">
  <apex:sectionHeader title="Account details"/>
  <apex:form >
   <apex:pageBlock >
   <apex:pageBlockSection >
   <apex:pageBlockTable value="{!accnt_list}" var="test_var">
   <apex:column headerValue="Action">
   <apex:commandLink value="EDIT" action="{!edit_row}">
   <apex:param name="edit_id" value="{!test_var.id}"/>
   </apex:commandLink>
   </apex:column>
   <apex:column headerValue="Account Name" value="{!test_var.Name}"/>
   <apex:column headerValue="Billing Street" value="{!test_var.BillingStreet}"/>
   <apex:column headerValue="Billing City" value="{!test_var.BillingCity}"/>
   <apex:column headerValue="Billing State" value="{!test_var.BillingState}"/>
   <apex:column headerValue="Billing Zip Code" value="{!test_var.BillingPostalCode}"/>    
   <apex:column headerValue="Billing Country" value="{!test_var.BillingCountry}"/>      
   <apex:column headerValue="Shipping Street" value="{!test_var.ShippingStreet}"/>
   <apex:column headerValue="Shipping City" value="{!test_var.ShippingCity}"/>
   <apex:column headerValue="Shipping State" value="{!test_var.ShippingState}"/>
   <apex:column headerValue="Shipping Zip Code" value="{!test_var.ShippingPostalCode}"/>    
   <apex:column headerValue="Shipping Country" value="{!test_var.ShippingCountry}"/>        
   </apex:pageBlockTable>
  
   </apex:pageBlockSection>
    </apex:pageBlock>

---------------------------------
So now I would like to create an extension so that I would like to use STR value(the id of account) and use it in another page. I tried online but all the codes I see are for a standard controller extension.

Thanks in advance