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
Nitish Singh 22Nitish Singh 22 

How to Save data from Visual Force component into a custom SObject

HI ,

I have vf component and I am trying to save data from this component into a custom SObject .
Because I am unable to use Standard Controllers in vf component I am struggling with this.
This is what my vf componet looks like


<apex:component controller="wk_NotesController" id="tst" allowDML="true">
    <apex:attribute name="componentValue" description="Attribute on the component."
                  type="Boolean" required="required" assignTo="{!controllerValue}"/>

        <apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopups"/>
        <apex:pageBlock >
           Older Notes Section 
        </apex:pageBlock>      
        <apex:outputPanel id="tstpopups">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
           <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
     <!-- Comments box -->       
    <apex:outputLabel styleClass="label"   value="{!$ObjectType.Account_Notes_and_Alerts__c.fields.Note_Text__c.Label}" />
    <apex:inputField id="txtcmnt" value="{!val.Note_Text__c}" styleClass="box"/>
              
       <!-- NOte Type Drpdwn -->
    <apex:outputLabel styleClass="label"   value="{!$ObjectType.Account_Notes_and_Alerts__c.fields.Note_Type__c.Label}" />
    <apex:inputField id="drpdwn" value="{!val.Note_Type__c}" styleClass="box"/>  

      <!-- Check Box -->
           <apex:outputLabel styleClass="label" value="{!$ObjectType.Account_Notes_and_Alerts__c.fields.Alert__c.Label}"></apex:outputLabel>
           <apex:inputCheckbox styleClass="" value="{!val.Alert__c}" />
   
    <apex:commandButton action="{!saveValues}" value="Save" id="btnSave" />               
          <apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="tstpopups"/>                  

              
            </apex:outputPanel>
        </apex:outputPanel>

</apex:component>
buggs sfdcbuggs sfdc
HI,

Check this link,it may help you.
https://developer.salesforce.com/forums/?id=906F0000000ABRSIA4

 
Vinuthh SVinuthh S
Hi Nitish

Please paste you controller code,then i will help you out.

Thanks 
Vinuthh S