2

I have created a custom visual force page to override the standard page for edit a custom object "Influencer__c".

This is my page:

apex:page Standardcontroller="Influencer__c" id="Page" tabstyle="Contact">

script type="text/javascript"> 

 <apex:page Standardcontroller="Influencer__c" id="Page"  tabstyle="Contact">

  <script type="text/javascript"> 
  function openLookup(baseURL, width, modified, searchParam){
    var originalbaseURL = baseURL;
    var originalwidth = width;
    var originalmodified = modified;
    var originalsearchParam = searchParam;

    var lookupType = baseURL.substr(baseURL.length-3, 3);
    if (modified == '1') baseURL = baseURL + searchParam;

    var isCustomLookup = false;

    // Following "001" is the lookup type for Account object so change this as per your standard or custom object
    if(lookupType == "003"){

      var urlArr = baseURL.split("&");
      var txtId = '';
      if(urlArr.length > 2) {
        urlArr = urlArr[1].split('=');
        txtId = urlArr[1];
      }

      // Following is the url of Custom Lookup page. 
      baseURL = "/apex/CustomInfluencerLookup?accplanid={!Influencer__c.Account_Plan__c}&txt=" + txtId;

      // Following is the id of apex:form control "myForm". 
      baseURL = baseURL + "&frm=" + escapeUTF("{!$Component.myForm}");
      if (modified == '1') {
        baseURL = baseURL + "&lksearch=" + searchParam;
      }

      // Following is the ID of inputField that is the lookup to be customized as custom lookup
      if(txtId.indexOf('mycontact') > -1 ){
        isCustomLookup = true;
      }
    }


    if(isCustomLookup == true){
      openPopup(baseURL, "lookup", 350, 480, "width="+width+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
    }
    else {
      if (modified == '1') originalbaseURL = originalbaseURL + originalsearchParam;
      openPopup(originalbaseURL, "lookup", 350, 480, "width="+originalwidth+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
    } 
  }
</script>



<apex:sectionHeader title="{!$ObjectType.Influencer__c.label}" subtitle="{!Influencer__c.name}"/>
    <apex:pageBlock title="{!$ObjectType.Influencer__c.label} Detail" mode="edit">
 <apex:pageBlockButtons>
        <apex:form>

            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton action="{!Cancel}" immediate="true" value="Cancel"/>

        </apex:form> 
        </apex:pageBlockButtons>


         <apex:form>
         <apex:pageBlock>
        <apex:pageBlockSection title="Information" columns="2"> 

            <apex:inputField value="{!Influencer__c.Name}"/>
          <apex:inputField value="{!Influencer__c.Account_Plan__c}" required="true"/>
          <apex:inputField id="mycontact" value="{!Influencer__c.Contact__c}" required="true"/> 
            <apex:inputField value="{!Influencer__c.Type__c}" required="false"/>
           <apex:inputField value="{!Influencer__c.CCS_Role__c}" required="false"/>
            <apex:inputField value="{!Influencer__c.IMPACT__c}" required="false"/> 
           <apex:inputField value="{!Influencer__c.Top_Goals__c}" required="false"/>
           <apex:inputField value="{!Influencer__c.Attitude_towards_QT__c}" required="false"/>
           <apex:inputField value="{!Influencer__c.Contact_Risk_Profile__c}" required="false"/>
           <apex:inputField value="{!Influencer__c.Time_Spent__c}" required="false"/>
           <apex:inputField value="{!Influencer__c.Has_Power__c}" required="false"/> 
           <apex:inputField value="{!Influencer__c.Has_Budget__c}" required="false"/>
            <apex:inputField value="{!Influencer__c.QT_Exec__c}" required="false"/>

        </apex:pageBlockSection>
        </apex:pageBlock>
        </apex:form>


       <apex:pageBlockSection showHeader="false" columns="2">
            <apex:outputField value="{!Influencer__c.CreatedById}"/>
            <apex:outputField value="{!Influencer__c.LastModifiedById}"/>
        </apex:pageBlockSection>
   </apex:pageBlock>

 </apex:page>

When I press the button SAVE the new informations are not saved.

Where am I wrong?

Any problem with code problem in the code's page or is it because i have overridden the button?

Please help me.

Thank you very much.

BR

3
Influencer.Account_Plan__c

I see above following has been used.

instead __c must be appended

Influencer__c.Account_Plan__c must be used in this case.

  • Please can you helpme again? When i press the button SAVE the new informations are not saved. Where am i wrong? have i a problem in the code's page or is it because i have overridden the button? I have updated my code in the question. Thank you very much. – Enry Jun 1 '13 at 13:17
  • please avoid multiple forms in page – Mohith Shrivastava Jun 1 '13 at 15:10
  • Thank you very much Mohith! you are great, I hope to become as good as you! Thanks again. – Enry Jun 1 '13 at 15:27
  • @Enry Thanks !Glad that it helped.Always love to contribute and help on this site – Mohith Shrivastava Jun 1 '13 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.