You need to sign in to do that
Don't have an account?
Nitish 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>
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>
Check this link,it may help you.
Please paste you controller code,then i will help you out.
Thanks
Vinuthh S